@embarkai/ui-kit 0.4.47 → 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 +599 -577
- package/dist/index.js +248 -229
- package/package.json +1 -1
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,30 +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
2453
|
setHasServerVault(true);
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
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);
|
|
2448
2462
|
}
|
|
2449
2463
|
} else {
|
|
2450
2464
|
setHasServerVault(false);
|
|
2451
|
-
setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
2465
|
+
useLayoutDataStore.getState().setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
2452
2466
|
console.warn("[BACKUP STATUS] No recovery data found in vault, marking as no-server-vault");
|
|
2453
2467
|
}
|
|
2454
2468
|
},
|
|
2455
2469
|
onError: (error) => {
|
|
2456
|
-
setHasServerVault(false);
|
|
2470
|
+
useSession.getState().setHasServerVault(false);
|
|
2457
2471
|
console.warn("[BACKUP STATUS] Failed to fetch initial vault status:", error);
|
|
2458
2472
|
}
|
|
2459
2473
|
});
|
|
@@ -2464,14 +2478,16 @@ function useBackupStatusChanges() {
|
|
|
2464
2478
|
};
|
|
2465
2479
|
}, []);
|
|
2466
2480
|
}
|
|
2467
|
-
var import_react_query3, import_react4;
|
|
2481
|
+
var import_react_query3, import_react4, NEW_USER_TOUCHED_KEY;
|
|
2468
2482
|
var init_useBackupStatusChanges = __esm({
|
|
2469
2483
|
"src/internal/hooks/useBackupStatusChanges.ts"() {
|
|
2470
2484
|
init_SessionContext();
|
|
2471
2485
|
import_react_query3 = require("@tanstack/react-query");
|
|
2472
2486
|
import_react4 = require("react");
|
|
2487
|
+
init_auth();
|
|
2473
2488
|
init_vaultClient();
|
|
2474
2489
|
init_useLayoutDataStore();
|
|
2490
|
+
NEW_USER_TOUCHED_KEY = "embarkai-is-new-user-touhced";
|
|
2475
2491
|
}
|
|
2476
2492
|
});
|
|
2477
2493
|
|
|
@@ -6636,7 +6652,7 @@ function PassKeyStep(props) {
|
|
|
6636
6652
|
setPasskeyStatus("checking available passkeys...");
|
|
6637
6653
|
setIsLoading(true);
|
|
6638
6654
|
try {
|
|
6639
|
-
|
|
6655
|
+
import_auth23.jwtTokenManager.clearTokens();
|
|
6640
6656
|
setPasskeyStatus("authenticating with passkey...");
|
|
6641
6657
|
const result = await authenticateWithPasskey(
|
|
6642
6658
|
void 0,
|
|
@@ -7127,8 +7143,8 @@ function Social(props) {
|
|
|
7127
7143
|
const iframeManager = getIframeManager2();
|
|
7128
7144
|
const finalizeSocialLogin = async (rawLoginResponse, providerKey, userData) => {
|
|
7129
7145
|
let loginResponse2 = await normalizeSocialLoginResponse(rawLoginResponse, providerKey, userData);
|
|
7130
|
-
const existingAccessToken =
|
|
7131
|
-
const existingRefreshToken =
|
|
7146
|
+
const existingAccessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
7147
|
+
const existingRefreshToken = import_auth23.jwtTokenManager.getRefreshToken();
|
|
7132
7148
|
if (existingAccessToken && existingRefreshToken && !loginResponse2.accessToken) {
|
|
7133
7149
|
console.log("[AuthModal] Using tokens already stored by iframe-manager");
|
|
7134
7150
|
loginResponse2 = {
|
|
@@ -7157,7 +7173,7 @@ function Social(props) {
|
|
|
7157
7173
|
setIsLoading(false);
|
|
7158
7174
|
return;
|
|
7159
7175
|
}
|
|
7160
|
-
await
|
|
7176
|
+
await import_auth23.jwtTokenManager.clearTokens();
|
|
7161
7177
|
if (!loginResponse2.accessToken || !loginResponse2.refreshToken) {
|
|
7162
7178
|
console.warn(
|
|
7163
7179
|
"[AuthModal] Authentication tokens were not issued; continuing with cookie-based session only."
|
|
@@ -7166,7 +7182,7 @@ function Social(props) {
|
|
|
7166
7182
|
let tokensPersisted = false;
|
|
7167
7183
|
const persistTokensIfAvailable = async () => {
|
|
7168
7184
|
if (!tokensPersisted && loginResponse2.accessToken && loginResponse2.refreshToken) {
|
|
7169
|
-
await
|
|
7185
|
+
await import_auth23.jwtTokenManager.setTokens(loginResponse2);
|
|
7170
7186
|
tokensPersisted = true;
|
|
7171
7187
|
}
|
|
7172
7188
|
};
|
|
@@ -7679,7 +7695,7 @@ function useAuthMenuHandlers() {
|
|
|
7679
7695
|
const iframeManager = getIframeManager2();
|
|
7680
7696
|
await iframeManager.authenticate(userId, loginResponse.avatar, loginResponse.displayName);
|
|
7681
7697
|
if (loginResponse.accessToken && loginResponse.refreshToken) {
|
|
7682
|
-
await
|
|
7698
|
+
await import_auth23.jwtTokenManager.setTokens(loginResponse);
|
|
7683
7699
|
} else {
|
|
7684
7700
|
console.warn("[ConnectWalletButton] Login response missing tokens; skipping jwtTokenManager.setTokens");
|
|
7685
7701
|
}
|
|
@@ -7744,7 +7760,7 @@ function useAuthMenuHandlers() {
|
|
|
7744
7760
|
setTimeout(() => useLayoutDataStore.getState().setPage("keyshare-restore" /* KEYSHARE_RESTORE */), 100);
|
|
7745
7761
|
} else {
|
|
7746
7762
|
pendingLoginResponseRef.current = null;
|
|
7747
|
-
await
|
|
7763
|
+
await import_auth23.jwtTokenManager.clearTokens();
|
|
7748
7764
|
setStatus("error");
|
|
7749
7765
|
setError(error?.message || String(error));
|
|
7750
7766
|
setAlert({
|
|
@@ -8190,7 +8206,7 @@ var init_AuthMenu = __esm({
|
|
|
8190
8206
|
const loginResponse = pendingWalletLogin;
|
|
8191
8207
|
setPendingWalletLogin(null);
|
|
8192
8208
|
console.log("[AuthMenu] Processing wallet login response:", loginResponse);
|
|
8193
|
-
|
|
8209
|
+
import_auth23.jwtTokenManager.clearTokens().then(() => {
|
|
8194
8210
|
pendingLoginResponseRef.current = loginResponse;
|
|
8195
8211
|
onAuthSuccess();
|
|
8196
8212
|
});
|
|
@@ -9460,7 +9476,7 @@ var init_queryKeys = __esm({
|
|
|
9460
9476
|
|
|
9461
9477
|
// src/internal/components/BuyMenu/binance/api.ts
|
|
9462
9478
|
function iframe() {
|
|
9463
|
-
const accessToken =
|
|
9479
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
9464
9480
|
if (!accessToken) {
|
|
9465
9481
|
throw new Error("Access token is not available");
|
|
9466
9482
|
}
|
|
@@ -10372,7 +10388,7 @@ var init_binance = __esm({
|
|
|
10372
10388
|
|
|
10373
10389
|
// src/internal/components/BuyMenu/finchpay/api.ts
|
|
10374
10390
|
function iframe2() {
|
|
10375
|
-
const accessToken =
|
|
10391
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
10376
10392
|
if (!accessToken) {
|
|
10377
10393
|
throw new Error("Access token is not available");
|
|
10378
10394
|
}
|
|
@@ -11871,17 +11887,7 @@ function ChainSwitchRequest() {
|
|
|
11871
11887
|
const config = useProviderConfig().config;
|
|
11872
11888
|
const isLoading = useSession((st) => st.isLoading);
|
|
11873
11889
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
11874
|
-
const setActiveChainId = useSession((st) => st.setActiveChainId);
|
|
11875
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11876
11890
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11877
|
-
const changeTouchedRef = (0, import_react30.useRef)(false);
|
|
11878
|
-
(0, import_react30.useEffect)(() => {
|
|
11879
|
-
if (!changeTouchedRef.current || chainConfig?.id !== config.current?.network?.chainId) return;
|
|
11880
|
-
setPage(null);
|
|
11881
|
-
return () => {
|
|
11882
|
-
changeTouchedRef.current = false;
|
|
11883
|
-
};
|
|
11884
|
-
}, [chainConfig, setPage]);
|
|
11885
11891
|
const prefferedChain = NETWORK_OPTIONS.find((ch) => ch.chainId === config.current?.network?.chainId) || null;
|
|
11886
11892
|
const PrefferedChainIcon = prefferedChain?.Icon || (() => null);
|
|
11887
11893
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -11900,7 +11906,7 @@ function ChainSwitchRequest() {
|
|
|
11900
11906
|
size: "icon",
|
|
11901
11907
|
variant: "ghost",
|
|
11902
11908
|
title: t("passport:common.back"),
|
|
11903
|
-
onClick: () => setPage("settings" /* SETTINGS */),
|
|
11909
|
+
onClick: () => useLayoutDataStore.getState().setPage("settings" /* SETTINGS */),
|
|
11904
11910
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react20.ArrowLeft, { className: "h-4 w-4" })
|
|
11905
11911
|
}
|
|
11906
11912
|
),
|
|
@@ -11932,8 +11938,8 @@ function ChainSwitchRequest() {
|
|
|
11932
11938
|
disabled: isLoading,
|
|
11933
11939
|
onClick: () => {
|
|
11934
11940
|
if (!config.current?.network?.chainId) return;
|
|
11935
|
-
|
|
11936
|
-
|
|
11941
|
+
useSession.getState().setActiveChainId(config.current.network.chainId);
|
|
11942
|
+
useLayoutDataStore.getState().setPage("chain" /* CHAIN */);
|
|
11937
11943
|
},
|
|
11938
11944
|
children: [
|
|
11939
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" }),
|
|
@@ -11947,7 +11953,7 @@ function ChainSwitchRequest() {
|
|
|
11947
11953
|
}
|
|
11948
11954
|
);
|
|
11949
11955
|
}
|
|
11950
|
-
var import_lucide_react20,
|
|
11956
|
+
var import_lucide_react20, import_react_i18next2, import_jsx_runtime49;
|
|
11951
11957
|
var init_ChainSwitchRequest = __esm({
|
|
11952
11958
|
"src/internal/components/ChainsMenu/ChainSwitchRequest.tsx"() {
|
|
11953
11959
|
init_networks4();
|
|
@@ -11955,7 +11961,6 @@ var init_ChainSwitchRequest = __esm({
|
|
|
11955
11961
|
init_SessionContext();
|
|
11956
11962
|
init_useT();
|
|
11957
11963
|
import_lucide_react20 = require("lucide-react");
|
|
11958
|
-
import_react30 = require("react");
|
|
11959
11964
|
import_react_i18next2 = require("react-i18next");
|
|
11960
11965
|
init_useLayoutDataStore();
|
|
11961
11966
|
init_useLayoutStore();
|
|
@@ -12052,8 +12057,8 @@ function DeviceLinkScreen() {
|
|
|
12052
12057
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
12053
12058
|
const maxScrollHeight = useLayoutStore((s) => s.maxScrollHeight);
|
|
12054
12059
|
const { mutate: link, isPending } = useLinkDevice();
|
|
12055
|
-
const [code, setCode] = (0,
|
|
12056
|
-
const [error, setError] = (0,
|
|
12060
|
+
const [code, setCode] = (0, import_react30.useState)("");
|
|
12061
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
12057
12062
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
12058
12063
|
function handleCodeChange(value) {
|
|
12059
12064
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -12112,10 +12117,10 @@ function DeviceLinkScreen() {
|
|
|
12112
12117
|
}
|
|
12113
12118
|
);
|
|
12114
12119
|
}
|
|
12115
|
-
var
|
|
12120
|
+
var import_react30, import_lucide_react21, import_jsx_runtime50, VALID_CHARS;
|
|
12116
12121
|
var init_DeviceLinkScreen = __esm({
|
|
12117
12122
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
12118
|
-
|
|
12123
|
+
import_react30 = require("react");
|
|
12119
12124
|
import_lucide_react21 = require("lucide-react");
|
|
12120
12125
|
init_Expandable2();
|
|
12121
12126
|
init_button();
|
|
@@ -12648,19 +12653,19 @@ function DeviceManageScreen() {
|
|
|
12648
12653
|
const userId = session?.mpcUserId || "";
|
|
12649
12654
|
const deviceId = pageParams?.deviceId;
|
|
12650
12655
|
const deviceName = pageParams?.deviceName;
|
|
12651
|
-
const guardianRef = (0,
|
|
12652
|
-
const [screen, setScreen] = (0,
|
|
12653
|
-
const [actionState, setActionState] = (0,
|
|
12654
|
-
const [password, setPassword] = (0,
|
|
12655
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12656
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12657
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
12658
|
-
(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)(() => {
|
|
12659
12664
|
if (!statusMessage) return;
|
|
12660
12665
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12661
12666
|
return () => clearTimeout(t);
|
|
12662
12667
|
}, [statusMessage]);
|
|
12663
|
-
(0,
|
|
12668
|
+
(0, import_react31.useEffect)(() => {
|
|
12664
12669
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12665
12670
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12666
12671
|
return;
|
|
@@ -12692,7 +12697,7 @@ function DeviceManageScreen() {
|
|
|
12692
12697
|
guardianRef.current?.close();
|
|
12693
12698
|
};
|
|
12694
12699
|
}, [deviceId]);
|
|
12695
|
-
const refreshList = (0,
|
|
12700
|
+
const refreshList = (0, import_react31.useCallback)(async () => {
|
|
12696
12701
|
const guardian = guardianRef.current;
|
|
12697
12702
|
if (!guardian || screen.step !== "connected") return;
|
|
12698
12703
|
try {
|
|
@@ -12701,7 +12706,7 @@ function DeviceManageScreen() {
|
|
|
12701
12706
|
} catch {
|
|
12702
12707
|
}
|
|
12703
12708
|
}, [screen]);
|
|
12704
|
-
const handleBackup = (0,
|
|
12709
|
+
const handleBackup = (0, import_react31.useCallback)(async () => {
|
|
12705
12710
|
const guardian = guardianRef.current;
|
|
12706
12711
|
const iframe4 = getIframeManager();
|
|
12707
12712
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12725,7 +12730,7 @@ function DeviceManageScreen() {
|
|
|
12725
12730
|
setActionState(null);
|
|
12726
12731
|
}
|
|
12727
12732
|
}, [password, userId, refreshList]);
|
|
12728
|
-
const handleOverwrite = (0,
|
|
12733
|
+
const handleOverwrite = (0, import_react31.useCallback)(async () => {
|
|
12729
12734
|
const guardian = guardianRef.current;
|
|
12730
12735
|
const iframe4 = getIframeManager();
|
|
12731
12736
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12745,7 +12750,7 @@ function DeviceManageScreen() {
|
|
|
12745
12750
|
setActionState(null);
|
|
12746
12751
|
}
|
|
12747
12752
|
}, [password, userId, refreshList]);
|
|
12748
|
-
const handleDelete = (0,
|
|
12753
|
+
const handleDelete = (0, import_react31.useCallback)(async (keyshareId) => {
|
|
12749
12754
|
const guardian = guardianRef.current;
|
|
12750
12755
|
if (!guardian) return;
|
|
12751
12756
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12912,10 +12917,10 @@ function DeviceManageScreen() {
|
|
|
12912
12917
|
}
|
|
12913
12918
|
);
|
|
12914
12919
|
}
|
|
12915
|
-
var
|
|
12920
|
+
var import_react31, import_lucide_react22, import_jsx_runtime51;
|
|
12916
12921
|
var init_DeviceManageScreen = __esm({
|
|
12917
12922
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
12918
|
-
|
|
12923
|
+
import_react31 = require("react");
|
|
12919
12924
|
import_lucide_react22 = require("lucide-react");
|
|
12920
12925
|
init_Expandable2();
|
|
12921
12926
|
init_button();
|
|
@@ -12938,11 +12943,11 @@ function DeviceRestoreScreen() {
|
|
|
12938
12943
|
const keyshareId = pageParams?.keyshareId;
|
|
12939
12944
|
const deviceId = pageParams?.deviceId;
|
|
12940
12945
|
const deviceName = pageParams?.deviceName;
|
|
12941
|
-
const [password, setPassword] = (0,
|
|
12942
|
-
const [isWorking, setIsWorking] = (0,
|
|
12943
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12944
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12945
|
-
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 () => {
|
|
12946
12951
|
if (!password || !keyshareId || !userId) return;
|
|
12947
12952
|
const iframe4 = getIframeManager();
|
|
12948
12953
|
if (!iframe4) {
|
|
@@ -13029,10 +13034,10 @@ function DeviceRestoreScreen() {
|
|
|
13029
13034
|
}
|
|
13030
13035
|
);
|
|
13031
13036
|
}
|
|
13032
|
-
var
|
|
13037
|
+
var import_react32, import_lucide_react23, import_jsx_runtime52;
|
|
13033
13038
|
var init_DeviceRestoreScreen = __esm({
|
|
13034
13039
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
13035
|
-
|
|
13040
|
+
import_react32 = require("react");
|
|
13036
13041
|
import_lucide_react23 = require("lucide-react");
|
|
13037
13042
|
init_Expandable2();
|
|
13038
13043
|
init_button();
|
|
@@ -13055,8 +13060,8 @@ function truncateAddress(address) {
|
|
|
13055
13060
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
13056
13061
|
}
|
|
13057
13062
|
function DeviceRow({ device }) {
|
|
13058
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
13059
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
13063
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react33.useState)(false);
|
|
13064
|
+
const [unlinkError, setUnlinkError] = (0, import_react33.useState)(null);
|
|
13060
13065
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
13061
13066
|
if (confirmingUnlink) {
|
|
13062
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: [
|
|
@@ -13170,10 +13175,10 @@ function DevicesMenu() {
|
|
|
13170
13175
|
}
|
|
13171
13176
|
);
|
|
13172
13177
|
}
|
|
13173
|
-
var
|
|
13178
|
+
var import_react33, import_lucide_react24, import_jsx_runtime53;
|
|
13174
13179
|
var init_DevicesMenu = __esm({
|
|
13175
13180
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
13176
|
-
|
|
13181
|
+
import_react33 = require("react");
|
|
13177
13182
|
import_lucide_react24 = require("lucide-react");
|
|
13178
13183
|
init_Expandable2();
|
|
13179
13184
|
init_button();
|
|
@@ -13185,12 +13190,43 @@ var init_DevicesMenu = __esm({
|
|
|
13185
13190
|
}
|
|
13186
13191
|
});
|
|
13187
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
|
+
|
|
13188
13224
|
// src/internal/components/KeyshareRestoreMenu/hooks/useRestoreStore.ts
|
|
13189
|
-
var
|
|
13225
|
+
var import_zustand7, useRestoreStore;
|
|
13190
13226
|
var init_useRestoreStore = __esm({
|
|
13191
13227
|
"src/internal/components/KeyshareRestoreMenu/hooks/useRestoreStore.ts"() {
|
|
13192
|
-
|
|
13193
|
-
useRestoreStore = (0,
|
|
13228
|
+
import_zustand7 = require("zustand");
|
|
13229
|
+
useRestoreStore = (0, import_zustand7.create)((set) => ({
|
|
13194
13230
|
method: null,
|
|
13195
13231
|
// recoveryData: null,
|
|
13196
13232
|
showPassword: false,
|
|
@@ -13235,7 +13271,7 @@ function useOnRestoreSuccess() {
|
|
|
13235
13271
|
setStatus
|
|
13236
13272
|
} = useSession();
|
|
13237
13273
|
const { setError, setSuccess } = useRestoreStore();
|
|
13238
|
-
const createSessionWithKeyshare = (0,
|
|
13274
|
+
const createSessionWithKeyshare = (0, import_react34.useCallback)(
|
|
13239
13275
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
13240
13276
|
try {
|
|
13241
13277
|
try {
|
|
@@ -13276,7 +13312,7 @@ function useOnRestoreSuccess() {
|
|
|
13276
13312
|
},
|
|
13277
13313
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13278
13314
|
);
|
|
13279
|
-
const onRestoreSuccess = (0,
|
|
13315
|
+
const onRestoreSuccess = (0, import_react34.useCallback)(async () => {
|
|
13280
13316
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13281
13317
|
const verify = await verifyToken2();
|
|
13282
13318
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13341,12 +13377,12 @@ function useOnRestoreSuccess() {
|
|
|
13341
13377
|
]);
|
|
13342
13378
|
return { onRestoreSuccess };
|
|
13343
13379
|
}
|
|
13344
|
-
var
|
|
13380
|
+
var import_react34;
|
|
13345
13381
|
var init_useOnRestoreSuccess = __esm({
|
|
13346
13382
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
13347
13383
|
init_ProviderContext();
|
|
13348
13384
|
init_SessionContext();
|
|
13349
|
-
|
|
13385
|
+
import_react34 = require("react");
|
|
13350
13386
|
init_useLayoutDataStore();
|
|
13351
13387
|
init_useLayoutStore();
|
|
13352
13388
|
init_useRestoreStore();
|
|
@@ -13398,9 +13434,9 @@ __export(passkey_exports2, {
|
|
|
13398
13434
|
linkPasskeyWithWebAuthn: () => linkPasskeyWithWebAuthn
|
|
13399
13435
|
});
|
|
13400
13436
|
async function completePasskeyLinking(payload) {
|
|
13401
|
-
const hasValidToken = await (0,
|
|
13437
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
13402
13438
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
13403
|
-
const response = await (0,
|
|
13439
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/complete`, {
|
|
13404
13440
|
method: "POST",
|
|
13405
13441
|
body: JSON.stringify(payload)
|
|
13406
13442
|
});
|
|
@@ -13410,9 +13446,9 @@ async function completePasskeyLinking(payload) {
|
|
|
13410
13446
|
}
|
|
13411
13447
|
}
|
|
13412
13448
|
async function beginPasskeyLinking() {
|
|
13413
|
-
const hasValidToken = await (0,
|
|
13449
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
13414
13450
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
13415
|
-
let res = await (0,
|
|
13451
|
+
let res = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/begin`, { method: "POST" });
|
|
13416
13452
|
if (res.ok) {
|
|
13417
13453
|
const begin2 = await res.json();
|
|
13418
13454
|
const options2 = {
|
|
@@ -13440,7 +13476,7 @@ async function beginPasskeyLinking() {
|
|
|
13440
13476
|
};
|
|
13441
13477
|
return { challengeId: begin2.challengeId, options: options2 };
|
|
13442
13478
|
}
|
|
13443
|
-
res = await (0,
|
|
13479
|
+
res = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/options`, { method: "GET" });
|
|
13444
13480
|
if (!res.ok) throw new Error("Failed to get passkey linking options");
|
|
13445
13481
|
const begin = await res.json();
|
|
13446
13482
|
const options = {
|
|
@@ -13472,7 +13508,7 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
13472
13508
|
if (!("credentials" in navigator) || !("create" in navigator.credentials)) {
|
|
13473
13509
|
throw new Error("WebAuthn not supported in this browser");
|
|
13474
13510
|
}
|
|
13475
|
-
const userId =
|
|
13511
|
+
const userId = import_auth23.jwtTokenManager.getUserId();
|
|
13476
13512
|
if (!userId) throw new Error("No authenticated user");
|
|
13477
13513
|
let challengeId = null;
|
|
13478
13514
|
let publicKeyOptions = null;
|
|
@@ -13771,7 +13807,7 @@ function useCreateBackup() {
|
|
|
13771
13807
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13772
13808
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13773
13809
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13774
|
-
(0,
|
|
13810
|
+
(0, import_react35.useEffect)(() => {
|
|
13775
13811
|
if (!hasServerVault) {
|
|
13776
13812
|
useRestoreStore.getState().setMethod("server");
|
|
13777
13813
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -13779,7 +13815,7 @@ function useCreateBackup() {
|
|
|
13779
13815
|
}, [hasServerVault]);
|
|
13780
13816
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13781
13817
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13782
|
-
const onBackupSuccess = (0,
|
|
13818
|
+
const onBackupSuccess = (0, import_react35.useCallback)(() => {
|
|
13783
13819
|
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13784
13820
|
}, [hasServerVault]);
|
|
13785
13821
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = (0, import_react_query17.useMutation)({
|
|
@@ -13788,18 +13824,16 @@ function useCreateBackup() {
|
|
|
13788
13824
|
if (!iframeManager) {
|
|
13789
13825
|
throw new Error("Iframe manager not initialized");
|
|
13790
13826
|
}
|
|
13791
|
-
const jwt =
|
|
13827
|
+
const jwt = import_auth23.jwtTokenManager.getTokens();
|
|
13792
13828
|
if (!usePasskey && !restorePassword) {
|
|
13793
13829
|
throw new Error("Please provide a password for the backup");
|
|
13794
13830
|
}
|
|
13795
13831
|
const password = !usePasskey ? restorePassword : void 0;
|
|
13796
|
-
console.log("[BACKUP STATUS] is new user:", jwt.isNewUser);
|
|
13797
13832
|
return {
|
|
13798
|
-
response: await iframeManager.createBackup(passportUserId, { method: "server", password }, jwt.accessToken)
|
|
13799
|
-
isNewUser: jwt.isNewUser
|
|
13833
|
+
response: await iframeManager.createBackup(passportUserId, { method: "server", password }, jwt.accessToken)
|
|
13800
13834
|
};
|
|
13801
13835
|
},
|
|
13802
|
-
onSuccess: async ({ response
|
|
13836
|
+
onSuccess: async ({ response }) => {
|
|
13803
13837
|
const { setError, setSuccess } = useRestoreStore.getState();
|
|
13804
13838
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13805
13839
|
if (response.success) {
|
|
@@ -13808,11 +13842,7 @@ function useCreateBackup() {
|
|
|
13808
13842
|
if (typeof window !== "undefined") {
|
|
13809
13843
|
window.dispatchEvent(
|
|
13810
13844
|
new CustomEvent("lumia-passport-backup-status-changed", {
|
|
13811
|
-
detail: {
|
|
13812
|
-
method: "server",
|
|
13813
|
-
success: true,
|
|
13814
|
-
navigateToNicknameMenu: !!isNewUser
|
|
13815
|
-
}
|
|
13845
|
+
detail: { method: "server", success: true }
|
|
13816
13846
|
})
|
|
13817
13847
|
);
|
|
13818
13848
|
}
|
|
@@ -13945,12 +13975,12 @@ function useCreateBackup() {
|
|
|
13945
13975
|
createPasskey
|
|
13946
13976
|
};
|
|
13947
13977
|
}
|
|
13948
|
-
var import_react_query17,
|
|
13978
|
+
var import_react_query17, import_react35;
|
|
13949
13979
|
var init_useCreateBackup = __esm({
|
|
13950
13980
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
13951
13981
|
init_SessionContext();
|
|
13952
13982
|
import_react_query17 = require("@tanstack/react-query");
|
|
13953
|
-
|
|
13983
|
+
import_react35 = require("react");
|
|
13954
13984
|
init_auth();
|
|
13955
13985
|
init_useLayoutStore();
|
|
13956
13986
|
init_iframe_manager();
|
|
@@ -14085,7 +14115,7 @@ function useValidateFileBackup() {
|
|
|
14085
14115
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
14086
14116
|
const setError = useRestoreStore((st) => st.setError);
|
|
14087
14117
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14088
|
-
(0,
|
|
14118
|
+
(0, import_react36.useEffect)(() => {
|
|
14089
14119
|
if (!restoreFile) {
|
|
14090
14120
|
return;
|
|
14091
14121
|
}
|
|
@@ -14106,10 +14136,10 @@ function useValidateFileBackup() {
|
|
|
14106
14136
|
reader.readAsText(restoreFile);
|
|
14107
14137
|
}, [restoreFile]);
|
|
14108
14138
|
}
|
|
14109
|
-
var
|
|
14139
|
+
var import_react36;
|
|
14110
14140
|
var init_useValidateFileBackup = __esm({
|
|
14111
14141
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
14112
|
-
|
|
14142
|
+
import_react36 = require("react");
|
|
14113
14143
|
init_useRestoreStore();
|
|
14114
14144
|
}
|
|
14115
14145
|
});
|
|
@@ -14137,7 +14167,7 @@ function MethodSelector(props) {
|
|
|
14137
14167
|
setError,
|
|
14138
14168
|
setSuccess
|
|
14139
14169
|
} = useRestoreStore();
|
|
14140
|
-
const recoveryRenderMethods = (0,
|
|
14170
|
+
const recoveryRenderMethods = (0, import_react37.useMemo)(() => {
|
|
14141
14171
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
14142
14172
|
let data = null;
|
|
14143
14173
|
switch (true) {
|
|
@@ -14152,7 +14182,7 @@ function MethodSelector(props) {
|
|
|
14152
14182
|
return methodsWithBackupData;
|
|
14153
14183
|
}, [mode, serverRecoveryStatus]);
|
|
14154
14184
|
if (!!selectedRecoveryMethod) return null;
|
|
14155
|
-
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)(
|
|
14156
14186
|
"div",
|
|
14157
14187
|
{
|
|
14158
14188
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -14186,12 +14216,12 @@ function MethodSelector(props) {
|
|
|
14186
14216
|
}
|
|
14187
14217
|
) });
|
|
14188
14218
|
}
|
|
14189
|
-
var import_lucide_react26,
|
|
14219
|
+
var import_lucide_react26, import_react37, import_jsx_runtime54, getRecoveryRenderMethods;
|
|
14190
14220
|
var init_MethodSelector = __esm({
|
|
14191
14221
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
14192
14222
|
init_useT();
|
|
14193
14223
|
import_lucide_react26 = require("lucide-react");
|
|
14194
|
-
|
|
14224
|
+
import_react37 = require("react");
|
|
14195
14225
|
init_guardian_backup();
|
|
14196
14226
|
init_PositiveIcon();
|
|
14197
14227
|
init_button();
|
|
@@ -14225,7 +14255,7 @@ function PasswordPasskey(props) {
|
|
|
14225
14255
|
onCreatePasskey
|
|
14226
14256
|
} = props;
|
|
14227
14257
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
14228
|
-
const actionRef = (0,
|
|
14258
|
+
const actionRef = (0, import_react38.useRef)(null);
|
|
14229
14259
|
const {
|
|
14230
14260
|
showPassword,
|
|
14231
14261
|
restorePassword,
|
|
@@ -14239,7 +14269,7 @@ function PasswordPasskey(props) {
|
|
|
14239
14269
|
} = useRestoreStore();
|
|
14240
14270
|
const { config } = useProviderConfig();
|
|
14241
14271
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
14242
|
-
(0,
|
|
14272
|
+
(0, import_react38.useEffect)(() => {
|
|
14243
14273
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
14244
14274
|
}, [isPasskeyEnabled, usePasskey]);
|
|
14245
14275
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
@@ -14394,7 +14424,7 @@ function PasswordPasskey(props) {
|
|
|
14394
14424
|
] })
|
|
14395
14425
|
] });
|
|
14396
14426
|
}
|
|
14397
|
-
var import_lucide_react27,
|
|
14427
|
+
var import_lucide_react27, import_react38, import_jsx_runtime55;
|
|
14398
14428
|
var init_PasswordPasskey = __esm({
|
|
14399
14429
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
14400
14430
|
init_ProviderContext();
|
|
@@ -14402,7 +14432,7 @@ var init_PasswordPasskey = __esm({
|
|
|
14402
14432
|
init_i18n();
|
|
14403
14433
|
init_utils2();
|
|
14404
14434
|
import_lucide_react27 = require("lucide-react");
|
|
14405
|
-
|
|
14435
|
+
import_react38 = require("react");
|
|
14406
14436
|
init_OtpIcon();
|
|
14407
14437
|
init_button();
|
|
14408
14438
|
init_highlight();
|
|
@@ -14578,7 +14608,7 @@ function Server(props) {
|
|
|
14578
14608
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14579
14609
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14580
14610
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14581
|
-
(0,
|
|
14611
|
+
(0, import_react39.useEffect)(() => {
|
|
14582
14612
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14583
14613
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14584
14614
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14601,7 +14631,7 @@ function Server(props) {
|
|
|
14601
14631
|
) : t("passport:backupMenu.vaultRestore")
|
|
14602
14632
|
}
|
|
14603
14633
|
),
|
|
14604
|
-
!!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: [
|
|
14605
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" }),
|
|
14606
14636
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "flex-1 block", children: [
|
|
14607
14637
|
t("passport:backupMenu.vaultRecoveryStatus"),
|
|
@@ -14613,7 +14643,7 @@ function Server(props) {
|
|
|
14613
14643
|
] })
|
|
14614
14644
|
] });
|
|
14615
14645
|
}
|
|
14616
|
-
var import_react_query19, import_dayjs3, import_lucide_react30,
|
|
14646
|
+
var import_react_query19, import_dayjs3, import_lucide_react30, import_react39, import_jsx_runtime58;
|
|
14617
14647
|
var init_Server = __esm({
|
|
14618
14648
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
14619
14649
|
init_SessionContext();
|
|
@@ -14622,7 +14652,7 @@ var init_Server = __esm({
|
|
|
14622
14652
|
import_react_query19 = require("@tanstack/react-query");
|
|
14623
14653
|
import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
14624
14654
|
import_lucide_react30 = require("lucide-react");
|
|
14625
|
-
|
|
14655
|
+
import_react39 = require("react");
|
|
14626
14656
|
init_highlight();
|
|
14627
14657
|
init_PasswordPasskey();
|
|
14628
14658
|
init_constants4();
|
|
@@ -14785,7 +14815,7 @@ function Cloud2(props) {
|
|
|
14785
14815
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14786
14816
|
}
|
|
14787
14817
|
});
|
|
14788
|
-
(0,
|
|
14818
|
+
(0, import_react40.useEffect)(() => {
|
|
14789
14819
|
if (isCloudProvidersLoading) return;
|
|
14790
14820
|
if (!!cloudProvidersError) {
|
|
14791
14821
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14849,13 +14879,13 @@ function Cloud2(props) {
|
|
|
14849
14879
|
)
|
|
14850
14880
|
] });
|
|
14851
14881
|
}
|
|
14852
|
-
var import_react_query20, import_lucide_react32,
|
|
14882
|
+
var import_react_query20, import_lucide_react32, import_react40, import_jsx_runtime60;
|
|
14853
14883
|
var init_Cloud = __esm({
|
|
14854
14884
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
14855
14885
|
init_SessionContext();
|
|
14856
14886
|
import_react_query20 = require("@tanstack/react-query");
|
|
14857
14887
|
import_lucide_react32 = require("lucide-react");
|
|
14858
|
-
|
|
14888
|
+
import_react40 = require("react");
|
|
14859
14889
|
init_button();
|
|
14860
14890
|
init_select();
|
|
14861
14891
|
init_PasswordPasskey();
|
|
@@ -14872,8 +14902,8 @@ function Guardian(props) {
|
|
|
14872
14902
|
const session = useSession((st) => st.session);
|
|
14873
14903
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
14874
14904
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
14875
|
-
const [isWorking, setIsWorking] = (0,
|
|
14876
|
-
const [step, setStep] = (0,
|
|
14905
|
+
const [isWorking, setIsWorking] = (0, import_react41.useState)(false);
|
|
14906
|
+
const [step, setStep] = (0, import_react41.useState)("idle");
|
|
14877
14907
|
const handleGuardianBackup = async () => {
|
|
14878
14908
|
if (!restorePassword) {
|
|
14879
14909
|
setError("Please enter a password");
|
|
@@ -15002,11 +15032,11 @@ function Guardian(props) {
|
|
|
15002
15032
|
] })
|
|
15003
15033
|
] });
|
|
15004
15034
|
}
|
|
15005
|
-
var
|
|
15035
|
+
var import_react41, import_lucide_react33, import_jsx_runtime61;
|
|
15006
15036
|
var init_Guardian = __esm({
|
|
15007
15037
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
15008
15038
|
init_SessionContext();
|
|
15009
|
-
|
|
15039
|
+
import_react41 = require("react");
|
|
15010
15040
|
import_lucide_react33 = require("lucide-react");
|
|
15011
15041
|
init_iframe_manager();
|
|
15012
15042
|
init_guardian_backup();
|
|
@@ -15029,7 +15059,7 @@ var init_methods = __esm({
|
|
|
15029
15059
|
});
|
|
15030
15060
|
|
|
15031
15061
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
15032
|
-
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;
|
|
15033
15063
|
var init_KeyshareRestoreMenu = __esm({
|
|
15034
15064
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
15035
15065
|
init_ProviderContext();
|
|
@@ -15037,9 +15067,11 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15037
15067
|
init_i18n();
|
|
15038
15068
|
import_react_query21 = require("@tanstack/react-query");
|
|
15039
15069
|
import_lucide_react34 = require("lucide-react");
|
|
15040
|
-
|
|
15070
|
+
import_react42 = require("react");
|
|
15071
|
+
import_wagmi = require("wagmi");
|
|
15041
15072
|
init_useLayoutDataStore();
|
|
15042
15073
|
init_useLayoutStore();
|
|
15074
|
+
init_useExternalWalletStore();
|
|
15043
15075
|
init_vaultClient();
|
|
15044
15076
|
init_Expandable2();
|
|
15045
15077
|
init_button();
|
|
@@ -15066,7 +15098,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15066
15098
|
const error = useRestoreStore((st) => st.error);
|
|
15067
15099
|
const success = useRestoreStore((st) => st.success);
|
|
15068
15100
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
15069
|
-
(0,
|
|
15101
|
+
(0, import_react42.useEffect)(() => {
|
|
15070
15102
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
15071
15103
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15072
15104
|
setIsDialogForced(true);
|
|
@@ -15079,6 +15111,18 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15079
15111
|
setIsDialogForced(false);
|
|
15080
15112
|
};
|
|
15081
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
|
+
});
|
|
15082
15126
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
15083
15127
|
const {
|
|
15084
15128
|
restoreFromServer: restoreFromServer2,
|
|
@@ -15094,7 +15138,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15094
15138
|
queryFn: async () => await getShareRecoveryStats()
|
|
15095
15139
|
});
|
|
15096
15140
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15097
|
-
(0,
|
|
15141
|
+
(0, import_react42.useEffect)(() => {
|
|
15098
15142
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
15099
15143
|
}, [hasServerBackup]);
|
|
15100
15144
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query21.useMutation)({
|
|
@@ -15114,6 +15158,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15114
15158
|
},
|
|
15115
15159
|
onSuccess: async ({ disconnectedUserId }) => {
|
|
15116
15160
|
await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
15161
|
+
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
15117
15162
|
const { setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
15118
15163
|
setSession(null);
|
|
15119
15164
|
setAddress(null);
|
|
@@ -15247,7 +15292,7 @@ function KeyshareBackupMenu() {
|
|
|
15247
15292
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15248
15293
|
const error = useRestoreStore((st) => st.error);
|
|
15249
15294
|
const success = useRestoreStore((st) => st.success);
|
|
15250
|
-
(0,
|
|
15295
|
+
(0, import_react43.useEffect)(() => {
|
|
15251
15296
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15252
15297
|
return () => {
|
|
15253
15298
|
setSuccess(null);
|
|
@@ -15266,7 +15311,7 @@ function KeyshareBackupMenu() {
|
|
|
15266
15311
|
queryFn: async () => await getShareRecoveryStats()
|
|
15267
15312
|
});
|
|
15268
15313
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15269
|
-
(0,
|
|
15314
|
+
(0, import_react43.useEffect)(() => {
|
|
15270
15315
|
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15271
15316
|
}, [hasRecoveryData]);
|
|
15272
15317
|
const {
|
|
@@ -15370,20 +15415,29 @@ function KeyshareBackupMenu() {
|
|
|
15370
15415
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react35.CheckCircle2, { className: "h-4 w-4 flex-shrink-0" }),
|
|
15371
15416
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "block w-full flex-1", children: success })
|
|
15372
15417
|
] }),
|
|
15373
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15418
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15419
|
+
Button,
|
|
15420
|
+
{
|
|
15421
|
+
variant: "default",
|
|
15422
|
+
size: "large",
|
|
15423
|
+
className: "w-full",
|
|
15424
|
+
onClick: () => useRestoreStore.getState().setSuccess(null),
|
|
15425
|
+
children: t("passport:common.continue")
|
|
15426
|
+
}
|
|
15427
|
+
)
|
|
15374
15428
|
] })
|
|
15375
15429
|
] })
|
|
15376
15430
|
}
|
|
15377
15431
|
);
|
|
15378
15432
|
}
|
|
15379
|
-
var import_react_query22, import_lucide_react35,
|
|
15433
|
+
var import_react_query22, import_lucide_react35, import_react43, import_jsx_runtime63, COMPONENTS;
|
|
15380
15434
|
var init_KeyshareBackupMenu = __esm({
|
|
15381
15435
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
15382
15436
|
init_SessionContext();
|
|
15383
15437
|
init_i18n();
|
|
15384
15438
|
import_react_query22 = require("@tanstack/react-query");
|
|
15385
15439
|
import_lucide_react35 = require("lucide-react");
|
|
15386
|
-
|
|
15440
|
+
import_react43 = require("react");
|
|
15387
15441
|
init_useLayoutDataStore();
|
|
15388
15442
|
init_useLayoutStore();
|
|
15389
15443
|
init_vaultClient();
|
|
@@ -15421,14 +15475,14 @@ function useColorMode() {
|
|
|
15421
15475
|
const preferedColorMode = config?.preferedColorMode;
|
|
15422
15476
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15423
15477
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15424
|
-
const setColorMode = (0,
|
|
15478
|
+
const setColorMode = (0, import_react44.useCallback)(
|
|
15425
15479
|
(mode) => {
|
|
15426
15480
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15427
15481
|
handleStoreColorMode(mode);
|
|
15428
15482
|
},
|
|
15429
15483
|
[handleStoreColorMode]
|
|
15430
15484
|
);
|
|
15431
|
-
(0,
|
|
15485
|
+
(0, import_react44.useEffect)(() => {
|
|
15432
15486
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15433
15487
|
if (!targetColorMode && !preferedColorMode) {
|
|
15434
15488
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15443,10 +15497,10 @@ function useColorMode() {
|
|
|
15443
15497
|
}, []);
|
|
15444
15498
|
return { colorMode, setColorMode };
|
|
15445
15499
|
}
|
|
15446
|
-
var
|
|
15500
|
+
var import_react44;
|
|
15447
15501
|
var init_useColorMode = __esm({
|
|
15448
15502
|
"src/hooks/useColorMode.ts"() {
|
|
15449
|
-
|
|
15503
|
+
import_react44 = require("react");
|
|
15450
15504
|
init_ProviderContext();
|
|
15451
15505
|
init_constants();
|
|
15452
15506
|
init_useLayoutStore();
|
|
@@ -15548,13 +15602,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
15548
15602
|
function useSumsubIframe({ iframeUrl }) {
|
|
15549
15603
|
const config = useProviderConfig().config;
|
|
15550
15604
|
const { colorMode } = useColorMode();
|
|
15551
|
-
const iframeRef = (0,
|
|
15552
|
-
const [isLoading, setIsLoading] = (0,
|
|
15553
|
-
const [error, setError] = (0,
|
|
15554
|
-
const [height, setHeight] = (0,
|
|
15555
|
-
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)("");
|
|
15556
15610
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15557
|
-
(0,
|
|
15611
|
+
(0, import_react45.useEffect)(() => {
|
|
15558
15612
|
setError(null);
|
|
15559
15613
|
setIsLoading(true);
|
|
15560
15614
|
setStatus("Preparing verification...");
|
|
@@ -15595,12 +15649,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
15595
15649
|
status
|
|
15596
15650
|
};
|
|
15597
15651
|
}
|
|
15598
|
-
var
|
|
15652
|
+
var import_react45;
|
|
15599
15653
|
var init_useSumsubIframe = __esm({
|
|
15600
15654
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
15601
15655
|
init_ProviderContext();
|
|
15602
15656
|
init_useColorMode();
|
|
15603
|
-
|
|
15657
|
+
import_react45 = require("react");
|
|
15604
15658
|
init_sumsub();
|
|
15605
15659
|
init_SumsubIframeManager();
|
|
15606
15660
|
}
|
|
@@ -15805,9 +15859,9 @@ var init_LanguagesMenu2 = __esm({
|
|
|
15805
15859
|
|
|
15806
15860
|
// src/internal/auth/providers/common.ts
|
|
15807
15861
|
async function getLinkedProviders() {
|
|
15808
|
-
const hasValidToken = await (0,
|
|
15862
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
15809
15863
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
15810
|
-
const response = await (0,
|
|
15864
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/providers`, { method: "GET" });
|
|
15811
15865
|
if (!response.ok) {
|
|
15812
15866
|
const errorData = await response.json().catch(() => ({}));
|
|
15813
15867
|
throw new Error(errorData.message || `Failed to fetch providers: ${response.statusText}`);
|
|
@@ -15816,11 +15870,11 @@ async function getLinkedProviders() {
|
|
|
15816
15870
|
return data.providers;
|
|
15817
15871
|
}
|
|
15818
15872
|
async function unlinkProvider(providerType, externalId) {
|
|
15819
|
-
const hasValidToken = await (0,
|
|
15873
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
15820
15874
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
15821
15875
|
let url = `${getTssUrl3()}/api/auth/unlink/${providerType}`;
|
|
15822
15876
|
if (externalId) url += `?externalId=${encodeURIComponent(externalId)}`;
|
|
15823
|
-
const response = await (0,
|
|
15877
|
+
const response = await (0, import_auth23.authenticatedFetch)(url, { method: "DELETE" });
|
|
15824
15878
|
if (!response.ok) {
|
|
15825
15879
|
const errorData = await response.json().catch(() => ({}));
|
|
15826
15880
|
throw new Error(errorData.message || `Failed to unlink provider: ${response.statusText}`);
|
|
@@ -15828,12 +15882,12 @@ async function unlinkProvider(providerType, externalId) {
|
|
|
15828
15882
|
try {
|
|
15829
15883
|
const data = await response.json();
|
|
15830
15884
|
if (data?.accessToken && data?.refreshToken && data?.expiresIn) {
|
|
15831
|
-
|
|
15885
|
+
import_auth23.jwtTokenManager.setTokens({
|
|
15832
15886
|
accessToken: data.accessToken,
|
|
15833
15887
|
refreshToken: data.refreshToken,
|
|
15834
|
-
userId:
|
|
15888
|
+
userId: import_auth23.jwtTokenManager.getUserId() || "",
|
|
15835
15889
|
expiresIn: data.expiresIn,
|
|
15836
|
-
hasKeyshare:
|
|
15890
|
+
hasKeyshare: import_auth23.jwtTokenManager.getHasKeyshare() ?? false
|
|
15837
15891
|
});
|
|
15838
15892
|
}
|
|
15839
15893
|
} catch {
|
|
@@ -15874,7 +15928,7 @@ function MainMenu() {
|
|
|
15874
15928
|
const { t } = useT();
|
|
15875
15929
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15876
15930
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15877
|
-
(0,
|
|
15931
|
+
(0, import_react46.useEffect)(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15878
15932
|
useProvidersList();
|
|
15879
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)(
|
|
15880
15934
|
Button,
|
|
@@ -15892,13 +15946,13 @@ function MainMenu() {
|
|
|
15892
15946
|
id
|
|
15893
15947
|
)) }) });
|
|
15894
15948
|
}
|
|
15895
|
-
var import_lucide_react40,
|
|
15949
|
+
var import_lucide_react40, import_react46, import_jsx_runtime68, MAIN_MENU_BUTTONS;
|
|
15896
15950
|
var init_MainMenu = __esm({
|
|
15897
15951
|
"src/internal/components/MainMenu/MainMenu.tsx"() {
|
|
15898
15952
|
init_SessionContext();
|
|
15899
15953
|
init_useT();
|
|
15900
15954
|
import_lucide_react40 = require("lucide-react");
|
|
15901
|
-
|
|
15955
|
+
import_react46 = require("react");
|
|
15902
15956
|
init_constants();
|
|
15903
15957
|
init_useLayoutDataStore();
|
|
15904
15958
|
init_useProvidersList();
|
|
@@ -15936,7 +15990,7 @@ function useLinkedProfiles() {
|
|
|
15936
15990
|
});
|
|
15937
15991
|
let avatar2 = null;
|
|
15938
15992
|
try {
|
|
15939
|
-
avatar2 =
|
|
15993
|
+
avatar2 = import_auth23.jwtTokenManager.getAvatar() || null;
|
|
15940
15994
|
} catch {
|
|
15941
15995
|
avatar2 = null;
|
|
15942
15996
|
}
|
|
@@ -15944,16 +15998,16 @@ function useLinkedProfiles() {
|
|
|
15944
15998
|
}
|
|
15945
15999
|
});
|
|
15946
16000
|
const { profiles = [], avatar = null } = data || {};
|
|
15947
|
-
const refresh = (0,
|
|
16001
|
+
const refresh = (0, import_react47.useCallback)(async () => {
|
|
15948
16002
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15949
16003
|
}, [qc, address]);
|
|
15950
16004
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15951
16005
|
}
|
|
15952
|
-
var import_react_query25,
|
|
16006
|
+
var import_react_query25, import_react47, LINKED_PROFILES_QUERY_KEY;
|
|
15953
16007
|
var init_linkedProfiles = __esm({
|
|
15954
16008
|
"src/modules/linkedProfiles.ts"() {
|
|
15955
16009
|
import_react_query25 = require("@tanstack/react-query");
|
|
15956
|
-
|
|
16010
|
+
import_react47 = require("react");
|
|
15957
16011
|
init_SessionContext();
|
|
15958
16012
|
init_auth();
|
|
15959
16013
|
init_common();
|
|
@@ -15963,11 +16017,11 @@ var init_linkedProfiles = __esm({
|
|
|
15963
16017
|
});
|
|
15964
16018
|
|
|
15965
16019
|
// src/internal/components/ManageWalletMenu/hooks/useStore.ts
|
|
15966
|
-
var
|
|
16020
|
+
var import_zustand8, useManageWalletStore;
|
|
15967
16021
|
var init_useStore = __esm({
|
|
15968
16022
|
"src/internal/components/ManageWalletMenu/hooks/useStore.ts"() {
|
|
15969
|
-
|
|
15970
|
-
useManageWalletStore = (0,
|
|
16023
|
+
import_zustand8 = require("zustand");
|
|
16024
|
+
useManageWalletStore = (0, import_zustand8.create)((set) => ({
|
|
15971
16025
|
alert: null,
|
|
15972
16026
|
emailStep: "input",
|
|
15973
16027
|
email: "",
|
|
@@ -16101,9 +16155,9 @@ var init_EmailForm = __esm({
|
|
|
16101
16155
|
|
|
16102
16156
|
// src/internal/auth/providers/email.ts
|
|
16103
16157
|
async function sendEmailLinkCode(email) {
|
|
16104
|
-
const hasValidToken = await (0,
|
|
16158
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
16105
16159
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16106
|
-
const response = await (0,
|
|
16160
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/email/send-code`, {
|
|
16107
16161
|
method: "POST",
|
|
16108
16162
|
body: JSON.stringify({ email })
|
|
16109
16163
|
});
|
|
@@ -16113,9 +16167,9 @@ async function sendEmailLinkCode(email) {
|
|
|
16113
16167
|
}
|
|
16114
16168
|
}
|
|
16115
16169
|
async function verifyEmailLinkCode(email, code) {
|
|
16116
|
-
const hasValidToken = await (0,
|
|
16170
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
16117
16171
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16118
|
-
const response = await (0,
|
|
16172
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/email/verify-code`, {
|
|
16119
16173
|
method: "POST",
|
|
16120
16174
|
credentials: "include",
|
|
16121
16175
|
body: JSON.stringify({ email, code })
|
|
@@ -16401,7 +16455,7 @@ var init_AddProvider = __esm({
|
|
|
16401
16455
|
|
|
16402
16456
|
// src/internal/components/ManageWalletMenu/EmailNotConnectedWarning.tsx
|
|
16403
16457
|
function EmailNotConnectedWarning() {
|
|
16404
|
-
const providers =
|
|
16458
|
+
const providers = import_auth23.jwtTokenManager.getProviders();
|
|
16405
16459
|
const hasEmail = providers.includes("email");
|
|
16406
16460
|
const { t } = useT();
|
|
16407
16461
|
const config = useProviderConfig().config;
|
|
@@ -16444,7 +16498,7 @@ function useLinkSocial() {
|
|
|
16444
16498
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16445
16499
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16446
16500
|
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
16447
|
-
const handleLinkSocialProvider =
|
|
16501
|
+
const handleLinkSocialProvider = import_react48.default.useCallback(
|
|
16448
16502
|
async (providerIdRaw) => {
|
|
16449
16503
|
const providerKey = providerIdRaw.toLowerCase();
|
|
16450
16504
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -16468,11 +16522,11 @@ function useLinkSocial() {
|
|
|
16468
16522
|
mode: "link"
|
|
16469
16523
|
};
|
|
16470
16524
|
try {
|
|
16471
|
-
await (0,
|
|
16525
|
+
await (0, import_auth23.ensureValidToken)();
|
|
16472
16526
|
} catch (tokenError) {
|
|
16473
16527
|
console.warn("[ManageWallet] ensureValidToken failed before linking", tokenError);
|
|
16474
16528
|
}
|
|
16475
|
-
const accessToken =
|
|
16529
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
16476
16530
|
if (accessToken) {
|
|
16477
16531
|
authConfig.token = accessToken;
|
|
16478
16532
|
}
|
|
@@ -16502,8 +16556,8 @@ function useLinkSocial() {
|
|
|
16502
16556
|
},
|
|
16503
16557
|
[config.social?.providers]
|
|
16504
16558
|
);
|
|
16505
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
16506
|
-
(0,
|
|
16559
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react48.default.useState(false);
|
|
16560
|
+
(0, import_react48.useEffect)(() => {
|
|
16507
16561
|
const key = providerType?.toLowerCase();
|
|
16508
16562
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16509
16563
|
if (isWalletLinking) {
|
|
@@ -16521,7 +16575,7 @@ function useLinkSocial() {
|
|
|
16521
16575
|
}
|
|
16522
16576
|
}, [providerType, linkIsLoading, socialLinkStarted, isWalletLinking, handleLinkSocialProvider]);
|
|
16523
16577
|
}
|
|
16524
|
-
var import_react_query30,
|
|
16578
|
+
var import_react_query30, import_react48;
|
|
16525
16579
|
var init_useLinkSocial = __esm({
|
|
16526
16580
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16527
16581
|
init_useLayoutDataStore();
|
|
@@ -16529,7 +16583,7 @@ var init_useLinkSocial = __esm({
|
|
|
16529
16583
|
init_SessionContext();
|
|
16530
16584
|
init_linkedProfiles();
|
|
16531
16585
|
import_react_query30 = require("@tanstack/react-query");
|
|
16532
|
-
|
|
16586
|
+
import_react48 = __toESM(require("react"), 1);
|
|
16533
16587
|
init_auth();
|
|
16534
16588
|
init_telegramBrowser();
|
|
16535
16589
|
init_useProvidersList();
|
|
@@ -16539,7 +16593,7 @@ var init_useLinkSocial = __esm({
|
|
|
16539
16593
|
|
|
16540
16594
|
// src/internal/auth/providers/telegram.ts
|
|
16541
16595
|
async function linkTelegram(telegramData) {
|
|
16542
|
-
const hasValidToken = await (0,
|
|
16596
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
16543
16597
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16544
16598
|
const formattedData = {
|
|
16545
16599
|
id: telegramData.id,
|
|
@@ -16550,7 +16604,7 @@ async function linkTelegram(telegramData) {
|
|
|
16550
16604
|
if (telegramData.last_name) formattedData.last_name = telegramData.last_name;
|
|
16551
16605
|
if (telegramData.username) formattedData.username = telegramData.username;
|
|
16552
16606
|
if (telegramData.photo_url) formattedData.photo_url = telegramData.photo_url;
|
|
16553
|
-
const response = await (0,
|
|
16607
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/telegram`, {
|
|
16554
16608
|
method: "POST",
|
|
16555
16609
|
body: JSON.stringify(formattedData)
|
|
16556
16610
|
});
|
|
@@ -16598,7 +16652,7 @@ function useLinkTelegram() {
|
|
|
16598
16652
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16599
16653
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16600
16654
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16601
|
-
const handleLinkTelegram = (0,
|
|
16655
|
+
const handleLinkTelegram = (0, import_react49.useCallback)(async () => {
|
|
16602
16656
|
try {
|
|
16603
16657
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16604
16658
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16645,8 +16699,8 @@ function useLinkTelegram() {
|
|
|
16645
16699
|
setLinkIsLoading(false);
|
|
16646
16700
|
}
|
|
16647
16701
|
}, [config.social?.providers]);
|
|
16648
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
16649
|
-
(0,
|
|
16702
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react49.useState)(false);
|
|
16703
|
+
(0, import_react49.useEffect)(() => {
|
|
16650
16704
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16651
16705
|
providerType,
|
|
16652
16706
|
linkIsLoading,
|
|
@@ -16663,20 +16717,20 @@ function useLinkTelegram() {
|
|
|
16663
16717
|
handleLinkTelegram();
|
|
16664
16718
|
}
|
|
16665
16719
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16666
|
-
(0,
|
|
16720
|
+
(0, import_react49.useEffect)(() => {
|
|
16667
16721
|
if (providerType !== "telegram") {
|
|
16668
16722
|
setTelegramLinkStarted(false);
|
|
16669
16723
|
}
|
|
16670
16724
|
}, [providerType]);
|
|
16671
16725
|
}
|
|
16672
|
-
var import_react_query31,
|
|
16726
|
+
var import_react_query31, import_react49;
|
|
16673
16727
|
var init_useLinkTelegram = __esm({
|
|
16674
16728
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16675
16729
|
init_ProviderContext();
|
|
16676
16730
|
init_SessionContext();
|
|
16677
16731
|
init_linkedProfiles();
|
|
16678
16732
|
import_react_query31 = require("@tanstack/react-query");
|
|
16679
|
-
|
|
16733
|
+
import_react49 = require("react");
|
|
16680
16734
|
init_telegram2();
|
|
16681
16735
|
init_useLayoutDataStore();
|
|
16682
16736
|
init_telegramBrowser();
|
|
@@ -16809,7 +16863,7 @@ function ManageWalletMenu() {
|
|
|
16809
16863
|
} = useManageWalletStore();
|
|
16810
16864
|
const configuredProviders = getConfiguredProviders(config.current);
|
|
16811
16865
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
16812
|
-
const renderProviders = (0,
|
|
16866
|
+
const renderProviders = (0, import_react50.useMemo)(() => {
|
|
16813
16867
|
const normalizeProviderName = (name) => {
|
|
16814
16868
|
if (name === "x") return "twitter";
|
|
16815
16869
|
return name;
|
|
@@ -16931,7 +16985,7 @@ function ManageWalletMenu() {
|
|
|
16931
16985
|
}
|
|
16932
16986
|
);
|
|
16933
16987
|
}
|
|
16934
|
-
var import_lodash_es8, import_lucide_react44,
|
|
16988
|
+
var import_lodash_es8, import_lucide_react44, import_react50, import_jsx_runtime73, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
16935
16989
|
var init_ManageWallet = __esm({
|
|
16936
16990
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
16937
16991
|
init_useLayoutDataStore();
|
|
@@ -16940,7 +16994,7 @@ var init_ManageWallet = __esm({
|
|
|
16940
16994
|
init_i18n();
|
|
16941
16995
|
import_lodash_es8 = require("lodash-es");
|
|
16942
16996
|
import_lucide_react44 = require("lucide-react");
|
|
16943
|
-
|
|
16997
|
+
import_react50 = require("react");
|
|
16944
16998
|
init_constants();
|
|
16945
16999
|
init_telegramBrowser();
|
|
16946
17000
|
init_Expandable2();
|
|
@@ -16967,48 +17021,17 @@ var init_ManageWallet = __esm({
|
|
|
16967
17021
|
}
|
|
16968
17022
|
});
|
|
16969
17023
|
|
|
16970
|
-
// src/internal/stores/useExternalWalletStore.ts
|
|
16971
|
-
var import_zustand8, useExternalWalletStore;
|
|
16972
|
-
var init_useExternalWalletStore = __esm({
|
|
16973
|
-
"src/internal/stores/useExternalWalletStore.ts"() {
|
|
16974
|
-
import_zustand8 = require("zustand");
|
|
16975
|
-
useExternalWalletStore = (0, import_zustand8.create)((set) => ({
|
|
16976
|
-
configMode: "linked",
|
|
16977
|
-
activeMode: "linked",
|
|
16978
|
-
externalAddress: null,
|
|
16979
|
-
externalChainId: null,
|
|
16980
|
-
isExternalConnected: false,
|
|
16981
|
-
connectorName: null,
|
|
16982
|
-
setConfigMode: (mode) => set({ configMode: mode }),
|
|
16983
|
-
setActiveMode: (mode) => set({ activeMode: mode }),
|
|
16984
|
-
setExternalWallet: ({ address, chainId, connectorName }) => set({
|
|
16985
|
-
externalAddress: address,
|
|
16986
|
-
externalChainId: chainId,
|
|
16987
|
-
isExternalConnected: true,
|
|
16988
|
-
connectorName
|
|
16989
|
-
}),
|
|
16990
|
-
clearExternalWallet: () => set({
|
|
16991
|
-
externalAddress: null,
|
|
16992
|
-
externalChainId: null,
|
|
16993
|
-
isExternalConnected: false,
|
|
16994
|
-
connectorName: null
|
|
16995
|
-
}),
|
|
16996
|
-
setExternalChainId: (chainId) => set({ externalChainId: chainId })
|
|
16997
|
-
}));
|
|
16998
|
-
}
|
|
16999
|
-
});
|
|
17000
|
-
|
|
17001
17024
|
// src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
|
|
17002
17025
|
function UnlinkProviderMenu() {
|
|
17003
17026
|
const qc = (0, import_react_query32.useQueryClient)();
|
|
17004
17027
|
const address = useSession((st) => st.address);
|
|
17005
17028
|
const { callbacksRef } = useProviderConfig();
|
|
17006
|
-
const { disconnect: disconnectExternalWallet } = (0,
|
|
17029
|
+
const { disconnect: disconnectExternalWallet } = (0, import_wagmi2.useDisconnect)();
|
|
17007
17030
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
17008
17031
|
const { t } = useT();
|
|
17009
17032
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17010
17033
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
17011
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
17034
|
+
const [confirmInput, setConfirmInput] = (0, import_react51.useState)("");
|
|
17012
17035
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query32.useMutation)({
|
|
17013
17036
|
mutationFn: async () => {
|
|
17014
17037
|
if (!confirmUnlink) {
|
|
@@ -17090,7 +17113,7 @@ function UnlinkProviderMenu() {
|
|
|
17090
17113
|
] })
|
|
17091
17114
|
] });
|
|
17092
17115
|
}
|
|
17093
|
-
var import_react_query32, import_lucide_react45,
|
|
17116
|
+
var import_react_query32, import_lucide_react45, import_react51, import_wagmi2, import_jsx_runtime74;
|
|
17094
17117
|
var init_UnlinkProviderMenu = __esm({
|
|
17095
17118
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
17096
17119
|
init_useLayoutDataStore();
|
|
@@ -17100,8 +17123,8 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
17100
17123
|
init_linkedProfiles();
|
|
17101
17124
|
import_react_query32 = require("@tanstack/react-query");
|
|
17102
17125
|
import_lucide_react45 = require("lucide-react");
|
|
17103
|
-
|
|
17104
|
-
|
|
17126
|
+
import_react51 = require("react");
|
|
17127
|
+
import_wagmi2 = require("wagmi");
|
|
17105
17128
|
init_auth();
|
|
17106
17129
|
init_useExternalWalletStore();
|
|
17107
17130
|
init_button();
|
|
@@ -17259,7 +17282,7 @@ function NicknameEditForm(props) {
|
|
|
17259
17282
|
const { t } = useT();
|
|
17260
17283
|
const passportWalletAddress = useSession((st) => st.address);
|
|
17261
17284
|
const { callbacksRef } = useProviderConfig();
|
|
17262
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
17285
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react52.useState)(false);
|
|
17263
17286
|
const {
|
|
17264
17287
|
mutate: changeNickname2,
|
|
17265
17288
|
isError: isNicknameChangeError,
|
|
@@ -17291,7 +17314,7 @@ function NicknameEditForm(props) {
|
|
|
17291
17314
|
);
|
|
17292
17315
|
}
|
|
17293
17316
|
});
|
|
17294
|
-
const handleInputChange = (0,
|
|
17317
|
+
const handleInputChange = (0, import_react52.useCallback)(
|
|
17295
17318
|
(e) => {
|
|
17296
17319
|
const value = e.target.value;
|
|
17297
17320
|
setInputValue(value);
|
|
@@ -17305,7 +17328,7 @@ function NicknameEditForm(props) {
|
|
|
17305
17328
|
},
|
|
17306
17329
|
[clientError, isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17307
17330
|
);
|
|
17308
|
-
const handleSubmit = (0,
|
|
17331
|
+
const handleSubmit = (0, import_react52.useCallback)(
|
|
17309
17332
|
(e) => {
|
|
17310
17333
|
if (!canChange) return;
|
|
17311
17334
|
e.preventDefault();
|
|
@@ -17369,7 +17392,7 @@ function NicknameEditForm(props) {
|
|
|
17369
17392
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px]", children: t("passport:nicknameMenu.hint") })
|
|
17370
17393
|
] });
|
|
17371
17394
|
}
|
|
17372
|
-
var import_react_query33, import_lucide_react47,
|
|
17395
|
+
var import_react_query33, import_lucide_react47, import_react52, import_jsx_runtime76;
|
|
17373
17396
|
var init_NicknameEditForm = __esm({
|
|
17374
17397
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
17375
17398
|
init_ProviderContext();
|
|
@@ -17377,7 +17400,7 @@ var init_NicknameEditForm = __esm({
|
|
|
17377
17400
|
init_i18n();
|
|
17378
17401
|
import_react_query33 = require("@tanstack/react-query");
|
|
17379
17402
|
import_lucide_react47 = require("lucide-react");
|
|
17380
|
-
|
|
17403
|
+
import_react52 = require("react");
|
|
17381
17404
|
init_PositiveIcon();
|
|
17382
17405
|
init_nickname();
|
|
17383
17406
|
init_profile();
|
|
@@ -17393,17 +17416,17 @@ var init_NicknameEditForm = __esm({
|
|
|
17393
17416
|
|
|
17394
17417
|
// src/internal/components/NicknameMenu/useNickname.ts
|
|
17395
17418
|
function useNicknameForm(currentNickname) {
|
|
17396
|
-
const [inputValue, setInputValue] = (0,
|
|
17419
|
+
const [inputValue, setInputValue] = (0, import_react53.useState)("");
|
|
17397
17420
|
const normalizedInputValue = normalizeNickname(inputValue);
|
|
17398
17421
|
const validation = validateNickname(inputValue);
|
|
17399
17422
|
const isValidForCheck = validation.valid && normalizedInputValue.length > 0;
|
|
17400
|
-
(0,
|
|
17423
|
+
(0, import_react53.useEffect)(() => {
|
|
17401
17424
|
setInputValue(currentNickname);
|
|
17402
17425
|
}, [currentNickname]);
|
|
17403
|
-
const [queryInputValue, setQueryInputValue] = (0,
|
|
17426
|
+
const [queryInputValue, setQueryInputValue] = (0, import_react53.useState)("");
|
|
17404
17427
|
const isSameAsCurrentNickname = normalizedInputValue === currentNickname.toLowerCase();
|
|
17405
17428
|
const shouldCheckAvailability = validation.valid && !isSameAsCurrentNickname && inputValue.length > 0;
|
|
17406
|
-
(0,
|
|
17429
|
+
(0, import_react53.useEffect)(() => {
|
|
17407
17430
|
if (!isValidForCheck || !shouldCheckAvailability) {
|
|
17408
17431
|
setQueryInputValue("");
|
|
17409
17432
|
return;
|
|
@@ -17432,11 +17455,11 @@ function useNicknameForm(currentNickname) {
|
|
|
17432
17455
|
availabilityQuery: query
|
|
17433
17456
|
};
|
|
17434
17457
|
}
|
|
17435
|
-
var import_react_query34,
|
|
17458
|
+
var import_react_query34, import_react53, DEBOUNCE_MS;
|
|
17436
17459
|
var init_useNickname = __esm({
|
|
17437
17460
|
"src/internal/components/NicknameMenu/useNickname.ts"() {
|
|
17438
17461
|
import_react_query34 = require("@tanstack/react-query");
|
|
17439
|
-
|
|
17462
|
+
import_react53 = require("react");
|
|
17440
17463
|
init_nickname();
|
|
17441
17464
|
init_profile();
|
|
17442
17465
|
init_nickname_validation();
|
|
@@ -17448,7 +17471,7 @@ var init_useNickname = __esm({
|
|
|
17448
17471
|
function NicknameMenu() {
|
|
17449
17472
|
const address = useSession((st) => st.address);
|
|
17450
17473
|
const { t } = useT();
|
|
17451
|
-
const [clientError, setClientError] = (0,
|
|
17474
|
+
const [clientError, setClientError] = (0, import_react54.useState)(null);
|
|
17452
17475
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17453
17476
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
17454
17477
|
const {
|
|
@@ -17535,7 +17558,7 @@ function NicknameMenu() {
|
|
|
17535
17558
|
}
|
|
17536
17559
|
);
|
|
17537
17560
|
}
|
|
17538
|
-
var import_react_query35, import_dayjs4, import_lucide_react48,
|
|
17561
|
+
var import_react_query35, import_dayjs4, import_lucide_react48, import_react54, import_jsx_runtime77;
|
|
17539
17562
|
var init_NicknameMenu = __esm({
|
|
17540
17563
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
17541
17564
|
init_SessionContext();
|
|
@@ -17543,7 +17566,7 @@ var init_NicknameMenu = __esm({
|
|
|
17543
17566
|
import_react_query35 = require("@tanstack/react-query");
|
|
17544
17567
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
17545
17568
|
import_lucide_react48 = require("lucide-react");
|
|
17546
|
-
|
|
17569
|
+
import_react54 = require("react");
|
|
17547
17570
|
init_nickname();
|
|
17548
17571
|
init_profile();
|
|
17549
17572
|
init_useLayoutDataStore();
|
|
@@ -17580,11 +17603,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17580
17603
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
17581
17604
|
const resolvedChainId = chainId ?? activeChainId;
|
|
17582
17605
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17583
|
-
const chainConfig = (0,
|
|
17606
|
+
const chainConfig = (0, import_react55.useMemo)(() => {
|
|
17584
17607
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
17585
17608
|
return (0, import_read14.getChainConfig)(chainId);
|
|
17586
17609
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17587
|
-
const publicClient = (0,
|
|
17610
|
+
const publicClient = (0, import_react55.useMemo)(() => {
|
|
17588
17611
|
if (shouldUseActiveClient) return activePublicClient;
|
|
17589
17612
|
if (!chainId) return activePublicClient;
|
|
17590
17613
|
try {
|
|
@@ -17601,12 +17624,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17601
17624
|
resolvedChainId
|
|
17602
17625
|
};
|
|
17603
17626
|
}
|
|
17604
|
-
var import_read14,
|
|
17627
|
+
var import_read14, import_react55, publicClientByChainId;
|
|
17605
17628
|
var init_useResolvedPublicClient = __esm({
|
|
17606
17629
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17607
17630
|
init_SessionContext();
|
|
17608
17631
|
import_read14 = require("@embarkai/core/read");
|
|
17609
|
-
|
|
17632
|
+
import_react55 = require("react");
|
|
17610
17633
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17611
17634
|
}
|
|
17612
17635
|
});
|
|
@@ -17616,7 +17639,7 @@ function useWatchTokens(options) {
|
|
|
17616
17639
|
const { address, chainId, enabled = true } = options;
|
|
17617
17640
|
const { config } = useProviderConfig();
|
|
17618
17641
|
const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
|
|
17619
|
-
const watchTokens = (0,
|
|
17642
|
+
const watchTokens = (0, import_react56.useMemo)(() => {
|
|
17620
17643
|
const allWatchTokens = config.current.watchTokens;
|
|
17621
17644
|
const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
|
|
17622
17645
|
return tokensForChain;
|
|
@@ -17698,12 +17721,12 @@ function useWatchTokens(options) {
|
|
|
17698
17721
|
refetch
|
|
17699
17722
|
};
|
|
17700
17723
|
}
|
|
17701
|
-
var import_react_query36,
|
|
17724
|
+
var import_react_query36, import_react56, import_viem6, WATCH_TOKENS_QUERY_KEY;
|
|
17702
17725
|
var init_useWatchTokens = __esm({
|
|
17703
17726
|
"src/internal/hooks/useWatchTokens.ts"() {
|
|
17704
17727
|
init_ProviderContext();
|
|
17705
17728
|
import_react_query36 = require("@tanstack/react-query");
|
|
17706
|
-
|
|
17729
|
+
import_react56 = require("react");
|
|
17707
17730
|
import_viem6 = require("viem");
|
|
17708
17731
|
init_useResolvedPublicClient();
|
|
17709
17732
|
WATCH_TOKENS_QUERY_KEY = "watch-tokens";
|
|
@@ -17841,11 +17864,11 @@ function useBlockscoutAssets(options) {
|
|
|
17841
17864
|
const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
|
|
17842
17865
|
const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
|
|
17843
17866
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
17844
|
-
const blockscoutClient = (0,
|
|
17867
|
+
const blockscoutClient = (0, import_react57.useMemo)(
|
|
17845
17868
|
() => blockscoutApiUrl ? (0, import_clients2.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
17846
17869
|
[blockscoutApiUrl]
|
|
17847
17870
|
);
|
|
17848
|
-
const lastRefreshRef = (0,
|
|
17871
|
+
const lastRefreshRef = (0, import_react57.useRef)(0);
|
|
17849
17872
|
const {
|
|
17850
17873
|
assets: watchTokenAssets,
|
|
17851
17874
|
isLoading: watchTokensLoading,
|
|
@@ -17914,7 +17937,7 @@ function useBlockscoutAssets(options) {
|
|
|
17914
17937
|
retry: 2,
|
|
17915
17938
|
retryDelay: 1e3
|
|
17916
17939
|
});
|
|
17917
|
-
const erc20TokenAddresses = (0,
|
|
17940
|
+
const erc20TokenAddresses = (0, import_react57.useMemo)(() => {
|
|
17918
17941
|
if (!tokenBalances) return [];
|
|
17919
17942
|
return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17920
17943
|
}, [tokenBalances]);
|
|
@@ -17958,7 +17981,7 @@ function useBlockscoutAssets(options) {
|
|
|
17958
17981
|
gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
17959
17982
|
retry: 1
|
|
17960
17983
|
});
|
|
17961
|
-
const assets = (0,
|
|
17984
|
+
const assets = (0, import_react57.useMemo)(() => {
|
|
17962
17985
|
const result = [];
|
|
17963
17986
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
17964
17987
|
if (nativeBalanceData) {
|
|
@@ -18004,7 +18027,7 @@ function useBlockscoutAssets(options) {
|
|
|
18004
18027
|
}
|
|
18005
18028
|
return result;
|
|
18006
18029
|
}, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
|
|
18007
|
-
const nativeBalance = (0,
|
|
18030
|
+
const nativeBalance = (0, import_react57.useMemo)(() => {
|
|
18008
18031
|
if (!nativeBalanceData) return null;
|
|
18009
18032
|
return {
|
|
18010
18033
|
value: nativeBalanceData.value,
|
|
@@ -18012,11 +18035,11 @@ function useBlockscoutAssets(options) {
|
|
|
18012
18035
|
symbol: nativeBalanceData.symbol
|
|
18013
18036
|
};
|
|
18014
18037
|
}, [nativeBalanceData]);
|
|
18015
|
-
const error = (0,
|
|
18038
|
+
const error = (0, import_react57.useMemo)(() => {
|
|
18016
18039
|
if (!tokensError) return null;
|
|
18017
18040
|
return createError(tokensError);
|
|
18018
18041
|
}, [tokensError]);
|
|
18019
|
-
const refreshBalances = (0,
|
|
18042
|
+
const refreshBalances = (0, import_react57.useCallback)(async () => {
|
|
18020
18043
|
const now = Date.now();
|
|
18021
18044
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
18022
18045
|
return;
|
|
@@ -18024,7 +18047,7 @@ function useBlockscoutAssets(options) {
|
|
|
18024
18047
|
lastRefreshRef.current = now;
|
|
18025
18048
|
await Promise.all([refetchNative(), refetchTokens(), refetchNfts(), refetchWatchTokens()]);
|
|
18026
18049
|
}, [refetchNative, refetchTokens, refetchNfts, refetchWatchTokens]);
|
|
18027
|
-
const getTokenBalance = (0,
|
|
18050
|
+
const getTokenBalance = (0, import_react57.useCallback)(
|
|
18028
18051
|
(tokenAddress) => {
|
|
18029
18052
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
18030
18053
|
},
|
|
@@ -18042,13 +18065,13 @@ function useBlockscoutAssets(options) {
|
|
|
18042
18065
|
lastUpdated: dataUpdatedAt || null
|
|
18043
18066
|
};
|
|
18044
18067
|
}
|
|
18045
|
-
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;
|
|
18046
18069
|
var init_useBlockscoutAssets = __esm({
|
|
18047
18070
|
"src/internal/hooks/useBlockscoutAssets.ts"() {
|
|
18048
18071
|
init_ProviderContext();
|
|
18049
18072
|
import_clients2 = require("@embarkai/core/clients");
|
|
18050
18073
|
import_react_query37 = require("@tanstack/react-query");
|
|
18051
|
-
|
|
18074
|
+
import_react57 = require("react");
|
|
18052
18075
|
import_viem7 = require("viem");
|
|
18053
18076
|
init_initial();
|
|
18054
18077
|
init_constants();
|
|
@@ -18165,8 +18188,8 @@ async function resolveAssetRate(symbol, address, customAssetRateQuery) {
|
|
|
18165
18188
|
}
|
|
18166
18189
|
function PortfolioItemImage(props) {
|
|
18167
18190
|
const { asset } = props;
|
|
18168
|
-
const [nftImageError, setNftImageError] = (0,
|
|
18169
|
-
const [logoError, setLogoError] = (0,
|
|
18191
|
+
const [nftImageError, setNftImageError] = (0, import_react58.useState)(false);
|
|
18192
|
+
const [logoError, setLogoError] = (0, import_react58.useState)(false);
|
|
18170
18193
|
const isNft = isNftAsset(asset);
|
|
18171
18194
|
const nftImage = getNftImage(asset);
|
|
18172
18195
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -18281,14 +18304,14 @@ function PortfolioItem(props) {
|
|
|
18281
18304
|
}
|
|
18282
18305
|
);
|
|
18283
18306
|
}
|
|
18284
|
-
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;
|
|
18285
18308
|
var init_PortfolioItem = __esm({
|
|
18286
18309
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
18287
18310
|
init_ProviderContext();
|
|
18288
18311
|
init_tokens();
|
|
18289
18312
|
import_react_query38 = require("@tanstack/react-query");
|
|
18290
18313
|
import_lucide_react49 = require("lucide-react");
|
|
18291
|
-
|
|
18314
|
+
import_react58 = require("react");
|
|
18292
18315
|
import_viem9 = require("viem");
|
|
18293
18316
|
init_base();
|
|
18294
18317
|
init_priceFormatter();
|
|
@@ -18320,7 +18343,7 @@ function PortfolioMenu() {
|
|
|
18320
18343
|
enabled: !!address
|
|
18321
18344
|
});
|
|
18322
18345
|
const shownProjectAssests = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18323
|
-
const refreshAllAssetsBalances = (0,
|
|
18346
|
+
const refreshAllAssetsBalances = (0, import_react59.useCallback)(() => {
|
|
18324
18347
|
Promise.all(shownProjectAssests.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18325
18348
|
refreshBlockscoutBalances();
|
|
18326
18349
|
}, [qc, shownProjectAssests, refreshBlockscoutBalances]);
|
|
@@ -18370,7 +18393,7 @@ function PortfolioMenu() {
|
|
|
18370
18393
|
}
|
|
18371
18394
|
);
|
|
18372
18395
|
}
|
|
18373
|
-
var import_react_query39, import_lucide_react50,
|
|
18396
|
+
var import_react_query39, import_lucide_react50, import_react59, import_jsx_runtime80;
|
|
18374
18397
|
var init_PortfolioMenu = __esm({
|
|
18375
18398
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
18376
18399
|
init_ProviderContext();
|
|
@@ -18378,7 +18401,7 @@ var init_PortfolioMenu = __esm({
|
|
|
18378
18401
|
init_i18n();
|
|
18379
18402
|
import_react_query39 = require("@tanstack/react-query");
|
|
18380
18403
|
import_lucide_react50 = require("lucide-react");
|
|
18381
|
-
|
|
18404
|
+
import_react59 = require("react");
|
|
18382
18405
|
init_useBlockscoutAssets();
|
|
18383
18406
|
init_useLayoutDataStore();
|
|
18384
18407
|
init_useLayoutStore();
|
|
@@ -18487,10 +18510,10 @@ function ReceiveMenu() {
|
|
|
18487
18510
|
const { t } = useT();
|
|
18488
18511
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18489
18512
|
const open = page === "receive";
|
|
18490
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
18491
|
-
const [copied, setCopied] = (0,
|
|
18492
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
18493
|
-
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)(() => {
|
|
18494
18517
|
if (!session?.ownerAddress) return null;
|
|
18495
18518
|
try {
|
|
18496
18519
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -18498,7 +18521,7 @@ function ReceiveMenu() {
|
|
|
18498
18521
|
return null;
|
|
18499
18522
|
}
|
|
18500
18523
|
}, [session?.ownerAddress]);
|
|
18501
|
-
(0,
|
|
18524
|
+
(0, import_react60.useEffect)(() => {
|
|
18502
18525
|
if (open && address) {
|
|
18503
18526
|
import_qrcode.default.toDataURL(address, {
|
|
18504
18527
|
width: 200,
|
|
@@ -18511,7 +18534,7 @@ function ReceiveMenu() {
|
|
|
18511
18534
|
});
|
|
18512
18535
|
}
|
|
18513
18536
|
}, [open, address]);
|
|
18514
|
-
const handleCopy = (0,
|
|
18537
|
+
const handleCopy = (0, import_react60.useCallback)(async () => {
|
|
18515
18538
|
if (!address) return;
|
|
18516
18539
|
try {
|
|
18517
18540
|
await navigator.clipboard.writeText(address);
|
|
@@ -18521,7 +18544,7 @@ function ReceiveMenu() {
|
|
|
18521
18544
|
console.error("Failed to copy address:", error);
|
|
18522
18545
|
}
|
|
18523
18546
|
}, [address]);
|
|
18524
|
-
const handleCopyFingerprint = (0,
|
|
18547
|
+
const handleCopyFingerprint = (0, import_react60.useCallback)(async () => {
|
|
18525
18548
|
if (!fingerprint) return;
|
|
18526
18549
|
try {
|
|
18527
18550
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18582,14 +18605,14 @@ function ReceiveMenu() {
|
|
|
18582
18605
|
}
|
|
18583
18606
|
);
|
|
18584
18607
|
}
|
|
18585
|
-
var import_lucide_react51, import_qrcode,
|
|
18608
|
+
var import_lucide_react51, import_qrcode, import_react60, import_jsx_runtime81;
|
|
18586
18609
|
var init_ReceiveMenu = __esm({
|
|
18587
18610
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
18588
18611
|
init_SessionContext();
|
|
18589
18612
|
init_i18n();
|
|
18590
18613
|
import_lucide_react51 = require("lucide-react");
|
|
18591
18614
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
18592
|
-
|
|
18615
|
+
import_react60 = require("react");
|
|
18593
18616
|
init_useLayoutDataStore();
|
|
18594
18617
|
init_useLayoutStore();
|
|
18595
18618
|
init_nickname_fingerprint();
|
|
@@ -19061,9 +19084,9 @@ function SecurityMenu() {
|
|
|
19061
19084
|
const { t } = useT();
|
|
19062
19085
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
19063
19086
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
19064
|
-
const userId =
|
|
19065
|
-
const serverHasKeyshare =
|
|
19066
|
-
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);
|
|
19067
19090
|
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
19068
19091
|
const localInfo = recoveryData?.keyshareInfo || {};
|
|
19069
19092
|
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
@@ -19139,13 +19162,13 @@ function SecurityMenu() {
|
|
|
19139
19162
|
}
|
|
19140
19163
|
);
|
|
19141
19164
|
}
|
|
19142
|
-
var import_react_query41, import_lucide_react57,
|
|
19165
|
+
var import_react_query41, import_lucide_react57, import_react61, import_jsx_runtime88;
|
|
19143
19166
|
var init_SecurityMenu = __esm({
|
|
19144
19167
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
19145
19168
|
init_i18n();
|
|
19146
19169
|
import_react_query41 = require("@tanstack/react-query");
|
|
19147
19170
|
import_lucide_react57 = require("lucide-react");
|
|
19148
|
-
|
|
19171
|
+
import_react61 = require("react");
|
|
19149
19172
|
init_auth();
|
|
19150
19173
|
init_useLayoutDataStore();
|
|
19151
19174
|
init_useLayoutStore();
|
|
@@ -19183,9 +19206,9 @@ async function walletLogin(walletData) {
|
|
|
19183
19206
|
return response.json();
|
|
19184
19207
|
}
|
|
19185
19208
|
async function linkWallet(walletData) {
|
|
19186
|
-
const hasValidToken = await (0,
|
|
19209
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
19187
19210
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
19188
|
-
const response = await (0,
|
|
19211
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/wallet`, {
|
|
19189
19212
|
method: "POST",
|
|
19190
19213
|
body: JSON.stringify(walletData)
|
|
19191
19214
|
});
|
|
@@ -19195,9 +19218,9 @@ async function linkWallet(walletData) {
|
|
|
19195
19218
|
}
|
|
19196
19219
|
}
|
|
19197
19220
|
async function unlinkWallet(address) {
|
|
19198
|
-
const hasValidToken = await (0,
|
|
19221
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
19199
19222
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
19200
|
-
const response = await (0,
|
|
19223
|
+
const response = await (0, import_auth23.authenticatedFetch)(
|
|
19201
19224
|
`${getTssUrl3()}/api/auth/unlink/wallet?address=${encodeURIComponent(address)}`,
|
|
19202
19225
|
{
|
|
19203
19226
|
method: "DELETE"
|
|
@@ -19408,16 +19431,16 @@ function SenderSelector(props) {
|
|
|
19408
19431
|
const { directWalletProfile } = props;
|
|
19409
19432
|
const { t } = useT();
|
|
19410
19433
|
const config = useProviderConfig().config;
|
|
19411
|
-
const { signMessageAsync } = (0,
|
|
19434
|
+
const { signMessageAsync } = (0, import_wagmi3.useSignMessage)();
|
|
19412
19435
|
const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
|
|
19413
19436
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19414
19437
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19415
|
-
const pendingWalletRef = (0,
|
|
19438
|
+
const pendingWalletRef = (0, import_react62.useRef)(null);
|
|
19416
19439
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19417
19440
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19418
19441
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19419
|
-
const [walletMessage, setWalletMessage] = (0,
|
|
19420
|
-
(0,
|
|
19442
|
+
const [walletMessage, setWalletMessage] = (0, import_react62.useState)(null);
|
|
19443
|
+
(0, import_react62.useEffect)(() => {
|
|
19421
19444
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19422
19445
|
}, [walletMessage]);
|
|
19423
19446
|
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0, import_react_query42.useMutation)({
|
|
@@ -19473,7 +19496,7 @@ function SenderSelector(props) {
|
|
|
19473
19496
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19474
19497
|
}
|
|
19475
19498
|
});
|
|
19476
|
-
(0,
|
|
19499
|
+
(0, import_react62.useEffect)(() => {
|
|
19477
19500
|
const pendingProfile = pendingWalletRef.current;
|
|
19478
19501
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19479
19502
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19548,15 +19571,15 @@ function SenderSelector(props) {
|
|
|
19548
19571
|
] })
|
|
19549
19572
|
] });
|
|
19550
19573
|
}
|
|
19551
|
-
var import_rainbowkit, import_react_query42,
|
|
19574
|
+
var import_rainbowkit, import_react_query42, import_react62, import_wagmi3, import_jsx_runtime89;
|
|
19552
19575
|
var init_SenderSelector = __esm({
|
|
19553
19576
|
"src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
|
|
19554
19577
|
init_ProviderContext();
|
|
19555
19578
|
init_i18n();
|
|
19556
19579
|
import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
19557
19580
|
import_react_query42 = require("@tanstack/react-query");
|
|
19558
|
-
|
|
19559
|
-
|
|
19581
|
+
import_react62 = require("react");
|
|
19582
|
+
import_wagmi3 = require("wagmi");
|
|
19560
19583
|
init_wallet();
|
|
19561
19584
|
init_useLayoutDataStore();
|
|
19562
19585
|
init_useExternalWalletStore();
|
|
@@ -19668,8 +19691,8 @@ var init_wallets = __esm({
|
|
|
19668
19691
|
function useAvailableSenders() {
|
|
19669
19692
|
const address = useSession((st) => st.address);
|
|
19670
19693
|
const { profiles } = useLinkedProfiles();
|
|
19671
|
-
const lastCalcedSenders = (0,
|
|
19672
|
-
(0,
|
|
19694
|
+
const lastCalcedSenders = (0, import_react63.useRef)([]);
|
|
19695
|
+
(0, import_react63.useEffect)(() => {
|
|
19673
19696
|
const sendersAccumulator = [
|
|
19674
19697
|
{
|
|
19675
19698
|
type: "embarkai-wallet",
|
|
@@ -19701,13 +19724,13 @@ function useAvailableSenders() {
|
|
|
19701
19724
|
directWalletProfile: profiles.filter((p) => p.provider === "wallet")[0] || null
|
|
19702
19725
|
};
|
|
19703
19726
|
}
|
|
19704
|
-
var
|
|
19727
|
+
var import_react63;
|
|
19705
19728
|
var init_useAvailableSenders = __esm({
|
|
19706
19729
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
19707
19730
|
init_SessionContext();
|
|
19708
19731
|
init_tokens();
|
|
19709
19732
|
init_linkedProfiles();
|
|
19710
|
-
|
|
19733
|
+
import_react63 = require("react");
|
|
19711
19734
|
init_wallets();
|
|
19712
19735
|
init_useFlowSelector();
|
|
19713
19736
|
init_useBridgeStore();
|
|
@@ -19716,7 +19739,7 @@ var init_useAvailableSenders = __esm({
|
|
|
19716
19739
|
|
|
19717
19740
|
// src/internal/components/SendMenu/hyperbridge/api.ts
|
|
19718
19741
|
function iframe3() {
|
|
19719
|
-
const accessToken =
|
|
19742
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
19720
19743
|
if (!accessToken) {
|
|
19721
19744
|
throw new Error("Access token is not available");
|
|
19722
19745
|
}
|
|
@@ -20050,29 +20073,29 @@ function useHyperlaneHistory() {
|
|
|
20050
20073
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
20051
20074
|
});
|
|
20052
20075
|
const { data: txHistoryData, isLoading: isBridgeTxHistoryLoading } = query;
|
|
20053
|
-
const txList = (0,
|
|
20076
|
+
const txList = (0, import_react64.useMemo)(
|
|
20054
20077
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
20055
20078
|
[txHistoryData]
|
|
20056
20079
|
);
|
|
20057
|
-
const updateExpandable = (0,
|
|
20080
|
+
const updateExpandable = (0, import_react64.useCallback)(
|
|
20058
20081
|
(0, import_lodash_es9.debounce)(() => {
|
|
20059
20082
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
20060
20083
|
}, 250),
|
|
20061
20084
|
[]
|
|
20062
20085
|
);
|
|
20063
|
-
(0,
|
|
20086
|
+
(0, import_react64.useEffect)(() => {
|
|
20064
20087
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
20065
20088
|
updateExpandable();
|
|
20066
20089
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
20067
20090
|
return { query, txList };
|
|
20068
20091
|
}
|
|
20069
|
-
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;
|
|
20070
20093
|
var init_useHyperlaneHistory = __esm({
|
|
20071
20094
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
20072
20095
|
init_SessionContext();
|
|
20073
20096
|
import_react_query43 = require("@tanstack/react-query");
|
|
20074
20097
|
import_lodash_es9 = require("lodash-es");
|
|
20075
|
-
|
|
20098
|
+
import_react64 = require("react");
|
|
20076
20099
|
init_useLayoutDataStore();
|
|
20077
20100
|
init_useFlowSelector();
|
|
20078
20101
|
init_api3();
|
|
@@ -20102,9 +20125,9 @@ function useBridge() {
|
|
|
20102
20125
|
const qc = (0, import_react_query44.useQueryClient)();
|
|
20103
20126
|
const { t } = useT();
|
|
20104
20127
|
const address = useSession((st) => st.address);
|
|
20105
|
-
const { data: walletClient } = (0,
|
|
20106
|
-
const { switchChainAsync } = (0,
|
|
20107
|
-
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)(() => {
|
|
20108
20131
|
const {
|
|
20109
20132
|
bridgeStep,
|
|
20110
20133
|
originChain,
|
|
@@ -20156,7 +20179,7 @@ function useBridge() {
|
|
|
20156
20179
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
20157
20180
|
}
|
|
20158
20181
|
});
|
|
20159
|
-
const handleQuoteEstimation = (0,
|
|
20182
|
+
const handleQuoteEstimation = (0, import_react65.useCallback)((amnt) => {
|
|
20160
20183
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
20161
20184
|
if (!amnt || !Number(amnt)) {
|
|
20162
20185
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -20281,15 +20304,15 @@ function useBridge() {
|
|
|
20281
20304
|
isAssetBridging
|
|
20282
20305
|
};
|
|
20283
20306
|
}
|
|
20284
|
-
var import_react_query44,
|
|
20307
|
+
var import_react_query44, import_react65, import_wagmi4;
|
|
20285
20308
|
var init_useBridge = __esm({
|
|
20286
20309
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
20287
20310
|
init_SessionContext();
|
|
20288
20311
|
init_i18n();
|
|
20289
20312
|
init_useExternalWalletStore();
|
|
20290
20313
|
import_react_query44 = require("@tanstack/react-query");
|
|
20291
|
-
|
|
20292
|
-
|
|
20314
|
+
import_react65 = require("react");
|
|
20315
|
+
import_wagmi4 = require("wagmi");
|
|
20293
20316
|
init_useLayoutStore();
|
|
20294
20317
|
init_useFlowSelector();
|
|
20295
20318
|
init_api3();
|
|
@@ -20318,7 +20341,7 @@ function useHyperlaneRoutes() {
|
|
|
20318
20341
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
20319
20342
|
queryFn: async () => getHyperlaneWarpRoutes()
|
|
20320
20343
|
});
|
|
20321
|
-
(0,
|
|
20344
|
+
(0, import_react66.useEffect)(() => {
|
|
20322
20345
|
if (!errorWarpRoutes) return;
|
|
20323
20346
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20324
20347
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20327,7 +20350,7 @@ function useHyperlaneRoutes() {
|
|
|
20327
20350
|
setOriginChain(null);
|
|
20328
20351
|
setDestinationChain(null);
|
|
20329
20352
|
}, [errorWarpRoutes]);
|
|
20330
|
-
(0,
|
|
20353
|
+
(0, import_react66.useEffect)(() => {
|
|
20331
20354
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20332
20355
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20333
20356
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20346,12 +20369,12 @@ function useHyperlaneRoutes() {
|
|
|
20346
20369
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
20347
20370
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
20348
20371
|
}
|
|
20349
|
-
var import_react_query45,
|
|
20372
|
+
var import_react_query45, import_react66, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
20350
20373
|
var init_useHyperlaneRoutes = __esm({
|
|
20351
20374
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
20352
20375
|
init_SessionContext();
|
|
20353
20376
|
import_react_query45 = require("@tanstack/react-query");
|
|
20354
|
-
|
|
20377
|
+
import_react66 = require("react");
|
|
20355
20378
|
init_useLayoutDataStore();
|
|
20356
20379
|
init_useFlowSelector();
|
|
20357
20380
|
init_api3();
|
|
@@ -20367,7 +20390,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
20367
20390
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20368
20391
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20369
20392
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20370
|
-
(0,
|
|
20393
|
+
(0, import_react67.useEffect)(() => {
|
|
20371
20394
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20372
20395
|
switch (true) {
|
|
20373
20396
|
case bridgeStep === "sender-selector":
|
|
@@ -20395,11 +20418,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
20395
20418
|
}
|
|
20396
20419
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
20397
20420
|
}
|
|
20398
|
-
var
|
|
20421
|
+
var import_react67;
|
|
20399
20422
|
var init_useMenuTitle = __esm({
|
|
20400
20423
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
20401
20424
|
init_i18n();
|
|
20402
|
-
|
|
20425
|
+
import_react67 = require("react");
|
|
20403
20426
|
init_useFlowSelector();
|
|
20404
20427
|
init_useBridgeStore();
|
|
20405
20428
|
}
|
|
@@ -20426,7 +20449,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20426
20449
|
const address = useSession((st) => st.address);
|
|
20427
20450
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
20428
20451
|
const directWalletChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
20429
|
-
const { switchChainAsync } = (0,
|
|
20452
|
+
const { switchChainAsync } = (0, import_wagmi5.useSwitchChain)();
|
|
20430
20453
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20431
20454
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
20432
20455
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
@@ -20506,7 +20529,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20506
20529
|
};
|
|
20507
20530
|
}
|
|
20508
20531
|
});
|
|
20509
|
-
const refreshRouteTokenBalance = (0,
|
|
20532
|
+
const refreshRouteTokenBalance = (0, import_react68.useCallback)(
|
|
20510
20533
|
(senderWallet) => {
|
|
20511
20534
|
switch (true) {
|
|
20512
20535
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20522,7 +20545,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20522
20545
|
},
|
|
20523
20546
|
[refreshBalances, qc]
|
|
20524
20547
|
);
|
|
20525
|
-
(0,
|
|
20548
|
+
(0, import_react68.useEffect)(() => {
|
|
20526
20549
|
if (!bridgeSender || !originChain) return;
|
|
20527
20550
|
switch (bridgeSender) {
|
|
20528
20551
|
case "embarkai-wallet":
|
|
@@ -20553,16 +20576,16 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20553
20576
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
20554
20577
|
};
|
|
20555
20578
|
}
|
|
20556
|
-
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;
|
|
20557
20580
|
var init_useBridgeBalance = __esm({
|
|
20558
20581
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20559
20582
|
init_SessionContext();
|
|
20560
20583
|
init_i18n();
|
|
20561
20584
|
import_core6 = require("@embarkai/core");
|
|
20562
20585
|
import_react_query46 = require("@tanstack/react-query");
|
|
20563
|
-
|
|
20586
|
+
import_react68 = require("react");
|
|
20564
20587
|
import_viem13 = require("viem");
|
|
20565
|
-
|
|
20588
|
+
import_wagmi5 = require("wagmi");
|
|
20566
20589
|
init_useBlockscoutAssets();
|
|
20567
20590
|
init_useExternalWalletStore();
|
|
20568
20591
|
init_useFlowSelector();
|
|
@@ -20678,7 +20701,7 @@ function SelectStep(props) {
|
|
|
20678
20701
|
variant: "outline",
|
|
20679
20702
|
size: "medium",
|
|
20680
20703
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20681
|
-
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: [
|
|
20682
20705
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react59.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20683
20706
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20684
20707
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20813,13 +20836,13 @@ function SelectStep(props) {
|
|
|
20813
20836
|
)
|
|
20814
20837
|
] });
|
|
20815
20838
|
}
|
|
20816
|
-
var import_lucide_react59,
|
|
20839
|
+
var import_lucide_react59, import_react69, import_jsx_runtime93;
|
|
20817
20840
|
var init_SelectStep = __esm({
|
|
20818
20841
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
20819
20842
|
init_tokens();
|
|
20820
20843
|
init_i18n();
|
|
20821
20844
|
import_lucide_react59 = require("lucide-react");
|
|
20822
|
-
|
|
20845
|
+
import_react69 = require("react");
|
|
20823
20846
|
init_priceFormatter();
|
|
20824
20847
|
init_utils2();
|
|
20825
20848
|
init_badge();
|
|
@@ -20868,7 +20891,7 @@ var init_checkbox = __esm({
|
|
|
20868
20891
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20869
20892
|
function ConfirmStep(props) {
|
|
20870
20893
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20871
|
-
const [userConsent, setUserConsent] = (0,
|
|
20894
|
+
const [userConsent, setUserConsent] = (0, import_react70.useState)(false);
|
|
20872
20895
|
const { t } = useT();
|
|
20873
20896
|
const address = useSession((st) => st.address);
|
|
20874
20897
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20977,13 +21000,13 @@ function ConfirmStep(props) {
|
|
|
20977
21000
|
)
|
|
20978
21001
|
] });
|
|
20979
21002
|
}
|
|
20980
|
-
var import_lucide_react61,
|
|
21003
|
+
var import_lucide_react61, import_react70, import_jsx_runtime95, P_CN;
|
|
20981
21004
|
var init_ConfirmStep = __esm({
|
|
20982
21005
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
20983
21006
|
init_SessionContext();
|
|
20984
21007
|
init_i18n();
|
|
20985
21008
|
import_lucide_react61 = require("lucide-react");
|
|
20986
|
-
|
|
21009
|
+
import_react70 = require("react");
|
|
20987
21010
|
init_priceFormatter();
|
|
20988
21011
|
init_utils2();
|
|
20989
21012
|
init_button();
|
|
@@ -21358,9 +21381,9 @@ var init_HistoryStep = __esm({
|
|
|
21358
21381
|
function SelectAssetRoute(props) {
|
|
21359
21382
|
const { hyperlaneWarpRoutes } = props;
|
|
21360
21383
|
const { t } = useT();
|
|
21361
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0,
|
|
21384
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react71.useState)(false);
|
|
21362
21385
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21363
|
-
const tokenList = (0,
|
|
21386
|
+
const tokenList = (0, import_react71.useMemo)(() => {
|
|
21364
21387
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
21365
21388
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
21366
21389
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -21457,13 +21480,13 @@ function SelectAssetRoute(props) {
|
|
|
21457
21480
|
] })
|
|
21458
21481
|
] });
|
|
21459
21482
|
}
|
|
21460
|
-
var import_lucide_react63,
|
|
21483
|
+
var import_lucide_react63, import_react71, import_jsx_runtime98;
|
|
21461
21484
|
var init_SelectAssetRoute = __esm({
|
|
21462
21485
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
21463
21486
|
init_tokens();
|
|
21464
21487
|
init_i18n();
|
|
21465
21488
|
import_lucide_react63 = require("lucide-react");
|
|
21466
|
-
|
|
21489
|
+
import_react71 = require("react");
|
|
21467
21490
|
init_button();
|
|
21468
21491
|
init_useFlowSelector();
|
|
21469
21492
|
init_ResolveChainIcon();
|
|
@@ -21491,7 +21514,7 @@ function HyperlaneBridge() {
|
|
|
21491
21514
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21492
21515
|
const { directWalletProfile } = useAvailableSenders();
|
|
21493
21516
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21494
|
-
(0,
|
|
21517
|
+
(0, import_react72.useEffect)(
|
|
21495
21518
|
() => () => {
|
|
21496
21519
|
useBridgeStore.getState().resetSelections();
|
|
21497
21520
|
},
|
|
@@ -21525,10 +21548,10 @@ function HyperlaneBridge() {
|
|
|
21525
21548
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(HistoryDetailsStep, {})
|
|
21526
21549
|
] });
|
|
21527
21550
|
}
|
|
21528
|
-
var
|
|
21551
|
+
var import_react72, import_jsx_runtime99;
|
|
21529
21552
|
var init_HyperlaneBridge = __esm({
|
|
21530
21553
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
21531
|
-
|
|
21554
|
+
import_react72 = require("react");
|
|
21532
21555
|
init_SenderSelector();
|
|
21533
21556
|
init_useAvailableSenders();
|
|
21534
21557
|
init_useBridge();
|
|
@@ -21546,7 +21569,7 @@ function BridgeHistorySwitch(props) {
|
|
|
21546
21569
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21547
21570
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21548
21571
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21549
|
-
const lastBridgeStepRef = (0,
|
|
21572
|
+
const lastBridgeStepRef = (0, import_react73.useRef)(null);
|
|
21550
21573
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21551
21574
|
return null;
|
|
21552
21575
|
}
|
|
@@ -21565,10 +21588,10 @@ function BridgeHistorySwitch(props) {
|
|
|
21565
21588
|
}
|
|
21566
21589
|
);
|
|
21567
21590
|
}
|
|
21568
|
-
var
|
|
21591
|
+
var import_react73, import_jsx_runtime100;
|
|
21569
21592
|
var init_HistorySwitch = __esm({
|
|
21570
21593
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
21571
|
-
|
|
21594
|
+
import_react73 = require("react");
|
|
21572
21595
|
init_switch();
|
|
21573
21596
|
init_useFlowSelector();
|
|
21574
21597
|
init_useBridgeStore();
|
|
@@ -21594,7 +21617,7 @@ function useErc3643Compliance(options) {
|
|
|
21594
21617
|
isLoading,
|
|
21595
21618
|
error: queryError,
|
|
21596
21619
|
refetch
|
|
21597
|
-
} = (0,
|
|
21620
|
+
} = (0, import_wagmi6.useReadContract)({
|
|
21598
21621
|
address: tokenAddress,
|
|
21599
21622
|
abi: ERC3643_CAN_TRANSFER_ABI,
|
|
21600
21623
|
functionName: "canTransfer",
|
|
@@ -21631,10 +21654,10 @@ function useErc3643Compliance(options) {
|
|
|
21631
21654
|
refetch
|
|
21632
21655
|
};
|
|
21633
21656
|
}
|
|
21634
|
-
var
|
|
21657
|
+
var import_wagmi6, ERC3643_CAN_TRANSFER_ABI;
|
|
21635
21658
|
var init_useErc3643Compliance = __esm({
|
|
21636
21659
|
"src/hooks/useErc3643Compliance.ts"() {
|
|
21637
|
-
|
|
21660
|
+
import_wagmi6 = require("wagmi");
|
|
21638
21661
|
ERC3643_CAN_TRANSFER_ABI = [
|
|
21639
21662
|
{
|
|
21640
21663
|
type: "function",
|
|
@@ -21659,11 +21682,11 @@ function looksLikeNickname(input) {
|
|
|
21659
21682
|
}
|
|
21660
21683
|
function useNicknameResolve(input, options) {
|
|
21661
21684
|
const { enabled = true, chainId } = options;
|
|
21662
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
21663
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
21685
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react74.useState)("");
|
|
21686
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react74.useState)(false);
|
|
21664
21687
|
const normalized = normalizeNickname(input);
|
|
21665
21688
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21666
|
-
(0,
|
|
21689
|
+
(0, import_react74.useEffect)(() => {
|
|
21667
21690
|
if (!isNicknameInput || !enabled) {
|
|
21668
21691
|
setDebouncedInput("");
|
|
21669
21692
|
setIsDebouncing(false);
|
|
@@ -21689,7 +21712,7 @@ function useNicknameResolve(input, options) {
|
|
|
21689
21712
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
21690
21713
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
21691
21714
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
21692
|
-
const fingerprintVerification = (0,
|
|
21715
|
+
const fingerprintVerification = (0, import_react74.useMemo)(() => {
|
|
21693
21716
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
21694
21717
|
return null;
|
|
21695
21718
|
}
|
|
@@ -21711,11 +21734,11 @@ function useNicknameResolve(input, options) {
|
|
|
21711
21734
|
resolvedAddress
|
|
21712
21735
|
};
|
|
21713
21736
|
}
|
|
21714
|
-
var import_react_query48,
|
|
21737
|
+
var import_react_query48, import_react74, DEBOUNCE_MS2;
|
|
21715
21738
|
var init_useNicknameResolve = __esm({
|
|
21716
21739
|
"src/hooks/useNicknameResolve.ts"() {
|
|
21717
21740
|
import_react_query48 = require("@tanstack/react-query");
|
|
21718
|
-
|
|
21741
|
+
import_react74 = require("react");
|
|
21719
21742
|
init_nickname();
|
|
21720
21743
|
init_profile();
|
|
21721
21744
|
init_nickname_validation();
|
|
@@ -21728,10 +21751,10 @@ var init_useNicknameResolve = __esm({
|
|
|
21728
21751
|
function useSendTransaction() {
|
|
21729
21752
|
const session = useSession((st) => st.session);
|
|
21730
21753
|
const address = useSession((st) => st.address);
|
|
21731
|
-
const [isLoading, setIsLoading] = (0,
|
|
21732
|
-
const [error, setError] = (0,
|
|
21733
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
21734
|
-
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)(
|
|
21735
21758
|
async (params) => {
|
|
21736
21759
|
if (!session || !address) {
|
|
21737
21760
|
setError("No active session");
|
|
@@ -21828,7 +21851,7 @@ function useSendTransaction() {
|
|
|
21828
21851
|
},
|
|
21829
21852
|
[session, address]
|
|
21830
21853
|
);
|
|
21831
|
-
const reset = (0,
|
|
21854
|
+
const reset = (0, import_react75.useCallback)(() => {
|
|
21832
21855
|
setError(null);
|
|
21833
21856
|
setUserOpHash(null);
|
|
21834
21857
|
setIsLoading(false);
|
|
@@ -21841,10 +21864,10 @@ function useSendTransaction() {
|
|
|
21841
21864
|
reset
|
|
21842
21865
|
};
|
|
21843
21866
|
}
|
|
21844
|
-
var
|
|
21867
|
+
var import_react75, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
21845
21868
|
var init_useSendTransaction = __esm({
|
|
21846
21869
|
"src/hooks/useSendTransaction.ts"() {
|
|
21847
|
-
|
|
21870
|
+
import_react75 = require("react");
|
|
21848
21871
|
import_viem14 = require("viem");
|
|
21849
21872
|
init_SessionContext();
|
|
21850
21873
|
init_account2();
|
|
@@ -21995,7 +22018,7 @@ var init_AssetInputIcon = __esm({
|
|
|
21995
22018
|
|
|
21996
22019
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21997
22020
|
function NftDisplayCard({ asset }) {
|
|
21998
|
-
const [imageError, setImageError] = (0,
|
|
22021
|
+
const [imageError, setImageError] = (0, import_react76.useState)(false);
|
|
21999
22022
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
22000
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: [
|
|
22001
22024
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
@@ -22023,11 +22046,11 @@ function NftDisplayCard({ asset }) {
|
|
|
22023
22046
|
] })
|
|
22024
22047
|
] });
|
|
22025
22048
|
}
|
|
22026
|
-
var import_lucide_react65,
|
|
22049
|
+
var import_lucide_react65, import_react76, import_jsx_runtime102;
|
|
22027
22050
|
var init_NftDisplayCard = __esm({
|
|
22028
22051
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
22029
22052
|
import_lucide_react65 = require("lucide-react");
|
|
22030
|
-
|
|
22053
|
+
import_react76 = require("react");
|
|
22031
22054
|
import_jsx_runtime102 = require("react/jsx-runtime");
|
|
22032
22055
|
}
|
|
22033
22056
|
});
|
|
@@ -22678,10 +22701,10 @@ function SendMenu() {
|
|
|
22678
22701
|
userOpHash,
|
|
22679
22702
|
reset
|
|
22680
22703
|
} = useSendTransaction();
|
|
22681
|
-
(0,
|
|
22704
|
+
(0, import_react77.useEffect)(() => {
|
|
22682
22705
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22683
22706
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22684
|
-
(0,
|
|
22707
|
+
(0, import_react77.useEffect)(() => {
|
|
22685
22708
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22686
22709
|
}, [sendTransactionError]);
|
|
22687
22710
|
const {
|
|
@@ -22696,7 +22719,7 @@ function SendMenu() {
|
|
|
22696
22719
|
} = useSendStore();
|
|
22697
22720
|
const isNft = isNftAsset3(selectedAsset);
|
|
22698
22721
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22699
|
-
(0,
|
|
22722
|
+
(0, import_react77.useEffect)(
|
|
22700
22723
|
() => () => {
|
|
22701
22724
|
setSelectedAsset(null);
|
|
22702
22725
|
setRecipient("");
|
|
@@ -22706,7 +22729,7 @@ function SendMenu() {
|
|
|
22706
22729
|
},
|
|
22707
22730
|
[]
|
|
22708
22731
|
);
|
|
22709
|
-
(0,
|
|
22732
|
+
(0, import_react77.useEffect)(() => {
|
|
22710
22733
|
const shouldSetNativeAsset = assets.length > 0 && !selectedAsset;
|
|
22711
22734
|
if (!shouldSetNativeAsset) return;
|
|
22712
22735
|
const native = assets.find((a) => a.type === "native");
|
|
@@ -22717,7 +22740,7 @@ function SendMenu() {
|
|
|
22717
22740
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
22718
22741
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
22719
22742
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
22720
|
-
const complianceAmount = (0,
|
|
22743
|
+
const complianceAmount = (0, import_react77.useMemo)(() => {
|
|
22721
22744
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
22722
22745
|
try {
|
|
22723
22746
|
return (0, import_viem18.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -22732,7 +22755,7 @@ function SendMenu() {
|
|
|
22732
22755
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22733
22756
|
chainId: activeChainId
|
|
22734
22757
|
});
|
|
22735
|
-
(0,
|
|
22758
|
+
(0, import_react77.useEffect)(() => {
|
|
22736
22759
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22737
22760
|
switch (true) {
|
|
22738
22761
|
case txStep === "select-asset":
|
|
@@ -22796,7 +22819,7 @@ function SendMenu() {
|
|
|
22796
22819
|
] })
|
|
22797
22820
|
] });
|
|
22798
22821
|
}
|
|
22799
|
-
var import_lucide_react69,
|
|
22822
|
+
var import_lucide_react69, import_react77, import_viem18, import_jsx_runtime107;
|
|
22800
22823
|
var init_SendMenu = __esm({
|
|
22801
22824
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
22802
22825
|
init_SessionContext();
|
|
@@ -22805,7 +22828,7 @@ var init_SendMenu = __esm({
|
|
|
22805
22828
|
init_useSendTransaction();
|
|
22806
22829
|
init_useT();
|
|
22807
22830
|
import_lucide_react69 = require("lucide-react");
|
|
22808
|
-
|
|
22831
|
+
import_react77 = require("react");
|
|
22809
22832
|
import_viem18 = require("viem");
|
|
22810
22833
|
init_useBlockscoutAssets();
|
|
22811
22834
|
init_useLayoutDataStore();
|
|
@@ -22890,7 +22913,7 @@ function SendFlowSelector() {
|
|
|
22890
22913
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22891
22914
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22892
22915
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22893
|
-
(0,
|
|
22916
|
+
(0, import_react78.useEffect)(
|
|
22894
22917
|
() => () => {
|
|
22895
22918
|
useFlowSelectorStore.getState().setError(null);
|
|
22896
22919
|
},
|
|
@@ -22967,12 +22990,12 @@ function SendFlowSelector() {
|
|
|
22967
22990
|
}
|
|
22968
22991
|
);
|
|
22969
22992
|
}
|
|
22970
|
-
var import_lucide_react70,
|
|
22993
|
+
var import_lucide_react70, import_react78, import_jsx_runtime108, SELECTOR_FLOW;
|
|
22971
22994
|
var init_SendFlowSelector = __esm({
|
|
22972
22995
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
22973
22996
|
init_i18n();
|
|
22974
22997
|
import_lucide_react70 = require("lucide-react");
|
|
22975
|
-
|
|
22998
|
+
import_react78 = require("react");
|
|
22976
22999
|
init_useLayoutDataStore();
|
|
22977
23000
|
init_useLayoutStore();
|
|
22978
23001
|
init_utils2();
|
|
@@ -23027,12 +23050,12 @@ function getServerSnapshot() {
|
|
|
23027
23050
|
return false;
|
|
23028
23051
|
}
|
|
23029
23052
|
function useProMode() {
|
|
23030
|
-
return (0,
|
|
23053
|
+
return (0, import_react79.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
23031
23054
|
}
|
|
23032
|
-
var
|
|
23055
|
+
var import_react79, STORAGE_KEY, EVENT_NAME;
|
|
23033
23056
|
var init_pro_mode = __esm({
|
|
23034
23057
|
"src/internal/lib/pro-mode.ts"() {
|
|
23035
|
-
|
|
23058
|
+
import_react79 = require("react");
|
|
23036
23059
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
23037
23060
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
23038
23061
|
}
|
|
@@ -23092,7 +23115,7 @@ function useSettingsButtons() {
|
|
|
23092
23115
|
if (proMode) {
|
|
23093
23116
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: import_lucide_react72.HardDrive });
|
|
23094
23117
|
}
|
|
23095
|
-
(0,
|
|
23118
|
+
(0, import_react80.useEffect)(() => {
|
|
23096
23119
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
23097
23120
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
23098
23121
|
return;
|
|
@@ -23156,7 +23179,7 @@ function SettingsMenu() {
|
|
|
23156
23179
|
}
|
|
23157
23180
|
);
|
|
23158
23181
|
}
|
|
23159
|
-
var import_react_query49, import_lucide_react72,
|
|
23182
|
+
var import_react_query49, import_lucide_react72, import_react80, import_jsx_runtime110;
|
|
23160
23183
|
var init_SettingsMenu = __esm({
|
|
23161
23184
|
"src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
|
|
23162
23185
|
init_ProviderContext();
|
|
@@ -23164,7 +23187,7 @@ var init_SettingsMenu = __esm({
|
|
|
23164
23187
|
init_i18n();
|
|
23165
23188
|
import_react_query49 = require("@tanstack/react-query");
|
|
23166
23189
|
import_lucide_react72 = require("lucide-react");
|
|
23167
|
-
|
|
23190
|
+
import_react80 = require("react");
|
|
23168
23191
|
init_nickname();
|
|
23169
23192
|
init_profile();
|
|
23170
23193
|
init_useLayoutDataStore();
|
|
@@ -24106,7 +24129,7 @@ function TransactionsMenu() {
|
|
|
24106
24129
|
const { t } = useT();
|
|
24107
24130
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24108
24131
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
24109
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
24132
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react81.useState)({});
|
|
24110
24133
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
24111
24134
|
const {
|
|
24112
24135
|
data: txHistoryGroups = [],
|
|
@@ -24119,7 +24142,7 @@ function TransactionsMenu() {
|
|
|
24119
24142
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
24120
24143
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
24121
24144
|
});
|
|
24122
|
-
const refreshTxHistory = (0,
|
|
24145
|
+
const refreshTxHistory = (0, import_react81.useCallback)(
|
|
24123
24146
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
24124
24147
|
[qc, chainConfig.id, address]
|
|
24125
24148
|
);
|
|
@@ -24168,14 +24191,14 @@ function TransactionsMenu() {
|
|
|
24168
24191
|
}
|
|
24169
24192
|
);
|
|
24170
24193
|
}
|
|
24171
|
-
var import_react_query50, import_lucide_react75,
|
|
24194
|
+
var import_react_query50, import_lucide_react75, import_react81, import_jsx_runtime114;
|
|
24172
24195
|
var init_TransactionsMenu = __esm({
|
|
24173
24196
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
24174
24197
|
init_SessionContext();
|
|
24175
24198
|
init_i18n();
|
|
24176
24199
|
import_react_query50 = require("@tanstack/react-query");
|
|
24177
24200
|
import_lucide_react75 = require("lucide-react");
|
|
24178
|
-
|
|
24201
|
+
import_react81 = require("react");
|
|
24179
24202
|
init_useLayoutDataStore();
|
|
24180
24203
|
init_useLayoutStore();
|
|
24181
24204
|
init_Expandable2();
|
|
@@ -24373,7 +24396,7 @@ function usePageMapper() {
|
|
|
24373
24396
|
setIsDialogOpen,
|
|
24374
24397
|
setIsDialogClosing
|
|
24375
24398
|
} = useLayoutStore();
|
|
24376
|
-
const closeDialog = (0,
|
|
24399
|
+
const closeDialog = (0, import_react82.useCallback)(() => {
|
|
24377
24400
|
setIsDialogClosing(true);
|
|
24378
24401
|
setTimeout(() => {
|
|
24379
24402
|
setDialogContent(null);
|
|
@@ -24384,7 +24407,7 @@ function usePageMapper() {
|
|
|
24384
24407
|
setIsDialogOpen(false);
|
|
24385
24408
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24386
24409
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24387
|
-
const openDialog = (0,
|
|
24410
|
+
const openDialog = (0, import_react82.useCallback)(
|
|
24388
24411
|
(pageItem) => {
|
|
24389
24412
|
const PageContentComponent = pageItem.component;
|
|
24390
24413
|
setDialogTitle(pageItem.title);
|
|
@@ -24394,7 +24417,7 @@ function usePageMapper() {
|
|
|
24394
24417
|
},
|
|
24395
24418
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24396
24419
|
);
|
|
24397
|
-
(0,
|
|
24420
|
+
(0, import_react82.useEffect)(() => {
|
|
24398
24421
|
if (page === null) return closeDialog();
|
|
24399
24422
|
const pageItem = PAGE_MAP[page];
|
|
24400
24423
|
if (!pageItem) {
|
|
@@ -24405,10 +24428,10 @@ function usePageMapper() {
|
|
|
24405
24428
|
openDialog(pageItem);
|
|
24406
24429
|
}, [page, closeDialog, openDialog]);
|
|
24407
24430
|
}
|
|
24408
|
-
var
|
|
24431
|
+
var import_react82, import_jsx_runtime115, CLEAR_DIALOG_TIMEOUT;
|
|
24409
24432
|
var init_usePageMapper = __esm({
|
|
24410
24433
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
24411
|
-
|
|
24434
|
+
import_react82 = require("react");
|
|
24412
24435
|
init_PageMap();
|
|
24413
24436
|
init_constants();
|
|
24414
24437
|
init_useLayoutDataStore();
|
|
@@ -24422,7 +24445,7 @@ var init_usePageMapper = __esm({
|
|
|
24422
24445
|
function useSettingsNotifications() {
|
|
24423
24446
|
const address = useSession((st) => st.address);
|
|
24424
24447
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
24425
|
-
const providers =
|
|
24448
|
+
const providers = import_auth23.jwtTokenManager.getProviders();
|
|
24426
24449
|
const hasEmail = providers.includes("email");
|
|
24427
24450
|
const { data: userProfile = null } = (0, import_react_query51.useQuery)({
|
|
24428
24451
|
retry: false,
|
|
@@ -24430,26 +24453,26 @@ function useSettingsNotifications() {
|
|
|
24430
24453
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24431
24454
|
queryFn: getUserProfile
|
|
24432
24455
|
});
|
|
24433
|
-
(0,
|
|
24456
|
+
(0, import_react83.useEffect)(() => {
|
|
24434
24457
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24435
24458
|
setSettingsNotifications({
|
|
24436
24459
|
...COMPLETE_KYC_PROGRESS,
|
|
24437
24460
|
status: isKYCVerified ? "resolved" : "active"
|
|
24438
24461
|
});
|
|
24439
24462
|
}, [userProfile, setSettingsNotifications]);
|
|
24440
|
-
(0,
|
|
24463
|
+
(0, import_react83.useEffect)(() => {
|
|
24441
24464
|
setSettingsNotifications({
|
|
24442
24465
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24443
24466
|
status: hasEmail ? "resolved" : "active"
|
|
24444
24467
|
});
|
|
24445
24468
|
}, [hasEmail, setSettingsNotifications]);
|
|
24446
24469
|
}
|
|
24447
|
-
var import_react_query51,
|
|
24470
|
+
var import_react_query51, import_react83, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
24448
24471
|
var init_useSettingsNotifications = __esm({
|
|
24449
24472
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
24450
24473
|
init_SessionContext();
|
|
24451
24474
|
import_react_query51 = require("@tanstack/react-query");
|
|
24452
|
-
|
|
24475
|
+
import_react83 = require("react");
|
|
24453
24476
|
init_auth();
|
|
24454
24477
|
init_profile();
|
|
24455
24478
|
init_useLayoutDataStore();
|
|
@@ -24472,7 +24495,7 @@ var init_package = __esm({
|
|
|
24472
24495
|
"package.json"() {
|
|
24473
24496
|
package_default = {
|
|
24474
24497
|
name: "@embarkai/ui-kit",
|
|
24475
|
-
version: "0.4.
|
|
24498
|
+
version: "0.4.48",
|
|
24476
24499
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24477
24500
|
type: "module",
|
|
24478
24501
|
main: "./dist/index.cjs",
|
|
@@ -24576,8 +24599,7 @@ function Footer() {
|
|
|
24576
24599
|
const { t } = useT();
|
|
24577
24600
|
const address = useSession((st) => st.address);
|
|
24578
24601
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24579
|
-
const
|
|
24580
|
-
const { disconnect: wagmiDisconnect } = (0, import_wagmi6.useDisconnect)({
|
|
24602
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi7.useDisconnect)({
|
|
24581
24603
|
mutation: {
|
|
24582
24604
|
onSuccess: () => {
|
|
24583
24605
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
@@ -24597,14 +24619,14 @@ function Footer() {
|
|
|
24597
24619
|
setError(null);
|
|
24598
24620
|
setStatus("disconnecting");
|
|
24599
24621
|
setIsLoading(true);
|
|
24600
|
-
const userId =
|
|
24622
|
+
const userId = import_auth23.jwtTokenManager.getUserId() || null;
|
|
24601
24623
|
const { logout: logout2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
24602
24624
|
await logout2();
|
|
24603
24625
|
return { disconnectedUserId: userId, disconnectAddress };
|
|
24604
24626
|
},
|
|
24605
24627
|
onSuccess: async ({ disconnectAddress, disconnectedUserId }) => {
|
|
24606
24628
|
await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
24607
|
-
if (!!
|
|
24629
|
+
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
24608
24630
|
const { setError, setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
24609
24631
|
setSession(null);
|
|
24610
24632
|
setAddress(null);
|
|
@@ -24675,7 +24697,7 @@ function Footer() {
|
|
|
24675
24697
|
}
|
|
24676
24698
|
);
|
|
24677
24699
|
}
|
|
24678
|
-
var import_react_query52, import_lucide_react76,
|
|
24700
|
+
var import_react_query52, import_lucide_react76, import_wagmi7, import_jsx_runtime116;
|
|
24679
24701
|
var init_Footer = __esm({
|
|
24680
24702
|
"src/internal/components/Footer/Footer.tsx"() {
|
|
24681
24703
|
init_package();
|
|
@@ -24685,7 +24707,7 @@ var init_Footer = __esm({
|
|
|
24685
24707
|
init_i18n();
|
|
24686
24708
|
import_react_query52 = require("@tanstack/react-query");
|
|
24687
24709
|
import_lucide_react76 = require("lucide-react");
|
|
24688
|
-
|
|
24710
|
+
import_wagmi7 = require("wagmi");
|
|
24689
24711
|
init_auth();
|
|
24690
24712
|
init_base();
|
|
24691
24713
|
init_useLayoutDataStore();
|
|
@@ -24716,11 +24738,11 @@ function Header() {
|
|
|
24716
24738
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24717
24739
|
const { t } = useT();
|
|
24718
24740
|
const proMode = useProMode();
|
|
24719
|
-
const [proToast, setProToast] = (0,
|
|
24720
|
-
const [copied, setCopied] = (0,
|
|
24721
|
-
const clickCountRef = (0,
|
|
24722
|
-
const clickTimerRef = (0,
|
|
24723
|
-
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)(() => {
|
|
24724
24746
|
clickCountRef.current += 1;
|
|
24725
24747
|
if (clickTimerRef.current) {
|
|
24726
24748
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24744,8 +24766,8 @@ function Header() {
|
|
|
24744
24766
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24745
24767
|
queryFn: getUserProfile
|
|
24746
24768
|
});
|
|
24747
|
-
const avatar = profile?.avatar ||
|
|
24748
|
-
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();
|
|
24749
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) }) }));
|
|
24750
24772
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
24751
24773
|
"div",
|
|
@@ -24820,7 +24842,7 @@ function Header() {
|
|
|
24820
24842
|
}
|
|
24821
24843
|
);
|
|
24822
24844
|
}
|
|
24823
|
-
var import_react_query53, import_lucide_react77,
|
|
24845
|
+
var import_react_query53, import_lucide_react77, import_react84, import_jsx_runtime117;
|
|
24824
24846
|
var init_Header = __esm({
|
|
24825
24847
|
"src/internal/components/Header/Header.tsx"() {
|
|
24826
24848
|
init_LumiaIcon3();
|
|
@@ -24830,7 +24852,7 @@ var init_Header = __esm({
|
|
|
24830
24852
|
init_useT();
|
|
24831
24853
|
import_react_query53 = require("@tanstack/react-query");
|
|
24832
24854
|
import_lucide_react77 = require("lucide-react");
|
|
24833
|
-
|
|
24855
|
+
import_react84 = require("react");
|
|
24834
24856
|
init_PositiveIcon();
|
|
24835
24857
|
init_auth();
|
|
24836
24858
|
init_profile();
|
|
@@ -24861,7 +24883,7 @@ function useDecideContentStyles() {
|
|
|
24861
24883
|
style: (0, import_lodash_es10.merge)({}, mobileStyles)
|
|
24862
24884
|
};
|
|
24863
24885
|
}
|
|
24864
|
-
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;
|
|
24865
24887
|
var init_dialog = __esm({
|
|
24866
24888
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24867
24889
|
init_utils2();
|
|
@@ -24870,14 +24892,14 @@ var init_dialog = __esm({
|
|
|
24870
24892
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24871
24893
|
import_lodash_es10 = require("lodash-es");
|
|
24872
24894
|
import_lucide_react78 = require("lucide-react");
|
|
24873
|
-
|
|
24895
|
+
import_react85 = require("react");
|
|
24874
24896
|
init_useLayoutDataStore();
|
|
24875
24897
|
init_useLayoutStore();
|
|
24876
24898
|
init_button();
|
|
24877
24899
|
import_jsx_runtime118 = require("react/jsx-runtime");
|
|
24878
24900
|
Dialog = DialogPrimitive.Root;
|
|
24879
24901
|
DialogPortal = DialogPrimitive.Portal;
|
|
24880
|
-
DialogOverlay = (0,
|
|
24902
|
+
DialogOverlay = (0, import_react85.forwardRef)(
|
|
24881
24903
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
24882
24904
|
DialogPrimitive.Overlay,
|
|
24883
24905
|
{
|
|
@@ -24899,7 +24921,7 @@ var init_dialog = __esm({
|
|
|
24899
24921
|
border: "1px solid var(--ui-kit-bd)",
|
|
24900
24922
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
24901
24923
|
};
|
|
24902
|
-
DialogContent = (0,
|
|
24924
|
+
DialogContent = (0, import_react85.forwardRef)(
|
|
24903
24925
|
({ className, children, colorMode, ...props }, ref) => {
|
|
24904
24926
|
const { t, i18n } = useT();
|
|
24905
24927
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -25002,7 +25024,7 @@ var init_dialog = __esm({
|
|
|
25002
25024
|
DialogHeader.displayName = "DialogHeader";
|
|
25003
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 });
|
|
25004
25026
|
DialogFooter.displayName = "DialogFooter";
|
|
25005
|
-
DialogTitle = (0,
|
|
25027
|
+
DialogTitle = (0, import_react85.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
25006
25028
|
DialogPrimitive.Title,
|
|
25007
25029
|
{
|
|
25008
25030
|
ref,
|
|
@@ -25011,7 +25033,7 @@ var init_dialog = __esm({
|
|
|
25011
25033
|
}
|
|
25012
25034
|
));
|
|
25013
25035
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
25014
|
-
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 }));
|
|
25015
25037
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
25016
25038
|
}
|
|
25017
25039
|
});
|
|
@@ -25036,7 +25058,7 @@ function Dialog2() {
|
|
|
25036
25058
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
25037
25059
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
25038
25060
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
25039
|
-
(0,
|
|
25061
|
+
(0, import_react86.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
25040
25062
|
usePageMapper();
|
|
25041
25063
|
useAutoConnect();
|
|
25042
25064
|
useBackupStatusChanges();
|
|
@@ -25074,13 +25096,13 @@ function Dialog2() {
|
|
|
25074
25096
|
}
|
|
25075
25097
|
);
|
|
25076
25098
|
}
|
|
25077
|
-
var import_framer_motion,
|
|
25099
|
+
var import_framer_motion, import_react86, import_jsx_runtime120;
|
|
25078
25100
|
var init_Dialog = __esm({
|
|
25079
25101
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
25080
25102
|
init_ProviderContext();
|
|
25081
25103
|
init_SessionContext();
|
|
25082
25104
|
import_framer_motion = require("framer-motion");
|
|
25083
|
-
|
|
25105
|
+
import_react86 = require("react");
|
|
25084
25106
|
init_constants();
|
|
25085
25107
|
init_useAutoConnect();
|
|
25086
25108
|
init_useBackupStatusChanges();
|
|
@@ -25106,14 +25128,14 @@ var init_Dialog2 = __esm({
|
|
|
25106
25128
|
});
|
|
25107
25129
|
|
|
25108
25130
|
// src/internal/components/TssManager.tsx
|
|
25109
|
-
var
|
|
25131
|
+
var import_react87, TssManagerWithRef;
|
|
25110
25132
|
var init_TssManager = __esm({
|
|
25111
25133
|
"src/internal/components/TssManager.tsx"() {
|
|
25112
25134
|
init_SessionContext();
|
|
25113
|
-
|
|
25135
|
+
import_react87 = __toESM(require("react"), 1);
|
|
25114
25136
|
init_auth();
|
|
25115
25137
|
init_clients();
|
|
25116
|
-
TssManagerWithRef =
|
|
25138
|
+
TssManagerWithRef = import_react87.default.forwardRef((props, ref) => {
|
|
25117
25139
|
const { mpcPin } = props;
|
|
25118
25140
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
25119
25141
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -25121,14 +25143,14 @@ var init_TssManager = __esm({
|
|
|
25121
25143
|
const setStatus = useSession((st) => st.setStatus);
|
|
25122
25144
|
const setSession = useSession((st) => st.setSession);
|
|
25123
25145
|
const setAddress = useSession((st) => st.setAddress);
|
|
25124
|
-
const onSessionCreated = (0,
|
|
25146
|
+
const onSessionCreated = (0, import_react87.useCallback)(
|
|
25125
25147
|
(session, address) => {
|
|
25126
25148
|
setSession(session);
|
|
25127
25149
|
setAddress(address);
|
|
25128
25150
|
},
|
|
25129
25151
|
[setSession, setAddress]
|
|
25130
25152
|
);
|
|
25131
|
-
const createSessionWithKeyshare =
|
|
25153
|
+
const createSessionWithKeyshare = import_react87.default.useCallback(
|
|
25132
25154
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
25133
25155
|
setStatus("checking key management setup...");
|
|
25134
25156
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -25153,7 +25175,7 @@ var init_TssManager = __esm({
|
|
|
25153
25175
|
},
|
|
25154
25176
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
25155
25177
|
);
|
|
25156
|
-
|
|
25178
|
+
import_react87.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
25157
25179
|
return null;
|
|
25158
25180
|
});
|
|
25159
25181
|
}
|
|
@@ -25164,10 +25186,10 @@ function WalletConnectHandler() {
|
|
|
25164
25186
|
const qc = (0, import_react_query54.useQueryClient)();
|
|
25165
25187
|
const { callbacksRef } = useProviderConfig();
|
|
25166
25188
|
const passportWalletAddress = useSession((st) => st.address);
|
|
25167
|
-
const { address: walletAddress, isConnected, chain, connector } = (0,
|
|
25189
|
+
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi8.useAccount)();
|
|
25168
25190
|
const { openConnectModal, connectModalOpen } = (0, import_rainbowkit2.useConnectModal)();
|
|
25169
|
-
const { disconnect } = (0,
|
|
25170
|
-
const { signMessageAsync } = (0,
|
|
25191
|
+
const { disconnect } = (0, import_wagmi8.useDisconnect)();
|
|
25192
|
+
const { signMessageAsync } = (0, import_wagmi8.useSignMessage)();
|
|
25171
25193
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
25172
25194
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
25173
25195
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
@@ -25181,7 +25203,7 @@ function WalletConnectHandler() {
|
|
|
25181
25203
|
const projectId = providerConfig?.projectId;
|
|
25182
25204
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
25183
25205
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
25184
|
-
const onLinkingComplete = (0,
|
|
25206
|
+
const onLinkingComplete = (0, import_react88.useCallback)(
|
|
25185
25207
|
async (success) => {
|
|
25186
25208
|
setIsWalletLinking(false);
|
|
25187
25209
|
if (!success && !passportWalletAddress) {
|
|
@@ -25210,10 +25232,10 @@ function WalletConnectHandler() {
|
|
|
25210
25232
|
},
|
|
25211
25233
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
25212
25234
|
);
|
|
25213
|
-
const [hasStartedLinking, setHasStartedLinking] =
|
|
25214
|
-
const [modalWasOpened, setModalWasOpened] =
|
|
25215
|
-
const [pendingModalOpen, setPendingModalOpen] =
|
|
25216
|
-
(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)(() => {
|
|
25217
25239
|
if (isWalletLinking && !hasStartedLinking) {
|
|
25218
25240
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
25219
25241
|
isConnected,
|
|
@@ -25251,18 +25273,18 @@ function WalletConnectHandler() {
|
|
|
25251
25273
|
setProviderType,
|
|
25252
25274
|
walletMode
|
|
25253
25275
|
]);
|
|
25254
|
-
(0,
|
|
25276
|
+
(0, import_react88.useEffect)(() => {
|
|
25255
25277
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25256
25278
|
setPendingModalOpen(false);
|
|
25257
25279
|
openConnectModal();
|
|
25258
25280
|
}
|
|
25259
25281
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25260
|
-
(0,
|
|
25282
|
+
(0, import_react88.useEffect)(() => {
|
|
25261
25283
|
if (connectModalOpen && hasStartedLinking) {
|
|
25262
25284
|
setModalWasOpened(true);
|
|
25263
25285
|
}
|
|
25264
25286
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25265
|
-
(0,
|
|
25287
|
+
(0, import_react88.useEffect)(() => {
|
|
25266
25288
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25267
25289
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25268
25290
|
onLinkingComplete(false);
|
|
@@ -25270,7 +25292,7 @@ function WalletConnectHandler() {
|
|
|
25270
25292
|
setModalWasOpened(false);
|
|
25271
25293
|
}
|
|
25272
25294
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25273
|
-
(0,
|
|
25295
|
+
(0, import_react88.useEffect)(() => {
|
|
25274
25296
|
if (isWalletLinking) {
|
|
25275
25297
|
const timeout = setTimeout(() => {
|
|
25276
25298
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25390,7 +25412,7 @@ function WalletConnectHandler() {
|
|
|
25390
25412
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25391
25413
|
}
|
|
25392
25414
|
});
|
|
25393
|
-
(0,
|
|
25415
|
+
(0, import_react88.useEffect)(() => {
|
|
25394
25416
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25395
25417
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25396
25418
|
if (!passportWalletAddress) {
|
|
@@ -25400,7 +25422,7 @@ function WalletConnectHandler() {
|
|
|
25400
25422
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25401
25423
|
}
|
|
25402
25424
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25403
|
-
(0,
|
|
25425
|
+
(0, import_react88.useEffect)(() => {
|
|
25404
25426
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25405
25427
|
const timeout = setTimeout(() => {
|
|
25406
25428
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25422,7 +25444,7 @@ function WalletConnectHandler() {
|
|
|
25422
25444
|
]);
|
|
25423
25445
|
return null;
|
|
25424
25446
|
}
|
|
25425
|
-
var import_rainbowkit2, import_react_query54,
|
|
25447
|
+
var import_rainbowkit2, import_react_query54, import_react88, import_wagmi8;
|
|
25426
25448
|
var init_WalletConnectHandler = __esm({
|
|
25427
25449
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25428
25450
|
init_ProviderContext();
|
|
@@ -25430,8 +25452,8 @@ var init_WalletConnectHandler = __esm({
|
|
|
25430
25452
|
init_linkedProfiles();
|
|
25431
25453
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25432
25454
|
import_react_query54 = require("@tanstack/react-query");
|
|
25433
|
-
|
|
25434
|
-
|
|
25455
|
+
import_react88 = __toESM(require("react"), 1);
|
|
25456
|
+
import_wagmi8 = require("wagmi");
|
|
25435
25457
|
init_wallet();
|
|
25436
25458
|
init_AuthMenu2();
|
|
25437
25459
|
init_useLayoutDataStore();
|
|
@@ -25443,7 +25465,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25443
25465
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25444
25466
|
function DirectWalletHandler() {
|
|
25445
25467
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
25446
|
-
const { address, isConnected, chain, connector } = (0,
|
|
25468
|
+
const { address, isConnected, chain, connector } = (0, import_wagmi9.useAccount)();
|
|
25447
25469
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
25448
25470
|
const externalAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
25449
25471
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
@@ -25451,13 +25473,13 @@ function DirectWalletHandler() {
|
|
|
25451
25473
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25452
25474
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25453
25475
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25454
|
-
(0,
|
|
25476
|
+
(0, import_react89.useEffect)(() => {
|
|
25455
25477
|
setConfigMode(walletMode);
|
|
25456
25478
|
if (walletMode !== "both") {
|
|
25457
25479
|
setActiveMode(walletMode);
|
|
25458
25480
|
}
|
|
25459
25481
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25460
|
-
(0,
|
|
25482
|
+
(0, import_react89.useEffect)(() => {
|
|
25461
25483
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25462
25484
|
setExternalWallet({
|
|
25463
25485
|
address,
|
|
@@ -25466,17 +25488,17 @@ function DirectWalletHandler() {
|
|
|
25466
25488
|
});
|
|
25467
25489
|
}
|
|
25468
25490
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25469
|
-
(0,
|
|
25491
|
+
(0, import_react89.useEffect)(() => {
|
|
25470
25492
|
if (isExternalConnected && !isConnected) {
|
|
25471
25493
|
clearExternalWallet();
|
|
25472
25494
|
}
|
|
25473
25495
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25474
|
-
(0,
|
|
25496
|
+
(0, import_react89.useEffect)(() => {
|
|
25475
25497
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25476
25498
|
setExternalChainId(chain.id);
|
|
25477
25499
|
}
|
|
25478
25500
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25479
|
-
(0,
|
|
25501
|
+
(0, import_react89.useEffect)(() => {
|
|
25480
25502
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25481
25503
|
setExternalWallet({
|
|
25482
25504
|
address,
|
|
@@ -25487,11 +25509,11 @@ function DirectWalletHandler() {
|
|
|
25487
25509
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25488
25510
|
return null;
|
|
25489
25511
|
}
|
|
25490
|
-
var
|
|
25512
|
+
var import_react89, import_wagmi9;
|
|
25491
25513
|
var init_DirectWalletHandler = __esm({
|
|
25492
25514
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25493
|
-
|
|
25494
|
-
|
|
25515
|
+
import_react89 = require("react");
|
|
25516
|
+
import_wagmi9 = require("wagmi");
|
|
25495
25517
|
init_ProviderContext();
|
|
25496
25518
|
init_useExternalWalletStore();
|
|
25497
25519
|
}
|
|
@@ -25515,7 +25537,7 @@ function waitForStoreHydration() {
|
|
|
25515
25537
|
}
|
|
25516
25538
|
function SessionProvider({ children }) {
|
|
25517
25539
|
const config = useProviderConfig().config;
|
|
25518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
25540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react90.Fragment, { children: [
|
|
25519
25541
|
children,
|
|
25520
25542
|
config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(WalletConnectHandler, {}),
|
|
25521
25543
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DirectWalletHandler, {}),
|
|
@@ -25530,11 +25552,11 @@ function SessionProvider({ children }) {
|
|
|
25530
25552
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Dialog2, {})
|
|
25531
25553
|
] });
|
|
25532
25554
|
}
|
|
25533
|
-
var import_read19,
|
|
25555
|
+
var import_read19, import_react90, import_zustand13, import_middleware4, import_jsx_runtime121, useSession, requireActiveChainId;
|
|
25534
25556
|
var init_SessionContext = __esm({
|
|
25535
25557
|
"src/context/SessionContext.tsx"() {
|
|
25536
25558
|
import_read19 = require("@embarkai/core/read");
|
|
25537
|
-
|
|
25559
|
+
import_react90 = require("react");
|
|
25538
25560
|
import_zustand13 = require("zustand");
|
|
25539
25561
|
import_middleware4 = require("zustand/middleware");
|
|
25540
25562
|
init_BalanceFeedProvider2();
|
|
@@ -26424,7 +26446,7 @@ var init_vaultClient = __esm({
|
|
|
26424
26446
|
|
|
26425
26447
|
// src/internal/auth/keyshare.ts
|
|
26426
26448
|
async function checkKeyshareStatusWithSync(userId) {
|
|
26427
|
-
const serverHasKeyshare = await (0,
|
|
26449
|
+
const serverHasKeyshare = await (0, import_auth23.syncKeyshareStatus)();
|
|
26428
26450
|
return checkKeyshareStatus(userId, serverHasKeyshare);
|
|
26429
26451
|
}
|
|
26430
26452
|
async function checkKeyshareStatus(userId, serverHasKeyshare) {
|
|
@@ -26458,7 +26480,7 @@ async function ensureKeyshareForNewUser(userId, onProgress) {
|
|
|
26458
26480
|
onProgress?.("Setting up secure key management...");
|
|
26459
26481
|
const result = await ensureDkgAndGetOwner(userId);
|
|
26460
26482
|
if (!result.ownerAddress) throw new Error("DKG completed but no owner address received");
|
|
26461
|
-
await (0,
|
|
26483
|
+
await (0, import_auth23.syncKeyshareStatus)();
|
|
26462
26484
|
onProgress?.("Key management setup complete");
|
|
26463
26485
|
return { ownerAddress: result.ownerAddress };
|
|
26464
26486
|
}
|
|
@@ -26543,7 +26565,7 @@ var init_keyshare = __esm({
|
|
|
26543
26565
|
|
|
26544
26566
|
// src/internal/auth/providers/x.ts
|
|
26545
26567
|
async function linkX() {
|
|
26546
|
-
const hasValidToken = await (0,
|
|
26568
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
26547
26569
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
26548
26570
|
throw new Error('Use openSocialAuthPopup("x") to link X account');
|
|
26549
26571
|
}
|
|
@@ -26551,10 +26573,10 @@ async function loginWithX() {
|
|
|
26551
26573
|
throw new Error('Use openSocialAuthPopup("x") to login with X account');
|
|
26552
26574
|
}
|
|
26553
26575
|
async function unlinkX(externalId) {
|
|
26554
|
-
const hasValidToken = await (0,
|
|
26576
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
26555
26577
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
26556
26578
|
const url = externalId ? `${getTssUrl3()}/api/auth/unlink/x?externalId=${encodeURIComponent(externalId)}` : `${getTssUrl3()}/api/auth/unlink/x`;
|
|
26557
|
-
const response = await (0,
|
|
26579
|
+
const response = await (0, import_auth23.authenticatedFetch)(url, {
|
|
26558
26580
|
method: "DELETE"
|
|
26559
26581
|
});
|
|
26560
26582
|
if (!response.ok) {
|
|
@@ -26585,9 +26607,9 @@ var init_providers = __esm({
|
|
|
26585
26607
|
// src/internal/auth/index.ts
|
|
26586
26608
|
var auth_exports = {};
|
|
26587
26609
|
__export(auth_exports, {
|
|
26588
|
-
JwtTokenManager: () =>
|
|
26610
|
+
JwtTokenManager: () => import_auth23.JwtTokenManager,
|
|
26589
26611
|
authenticateWithPasskey: () => authenticateWithPasskey,
|
|
26590
|
-
authenticatedFetch: () =>
|
|
26612
|
+
authenticatedFetch: () => import_auth23.authenticatedFetch,
|
|
26591
26613
|
beginPasskeyAuthentication: () => beginPasskeyAuthentication,
|
|
26592
26614
|
beginPasskeyLinking: () => beginPasskeyLinking,
|
|
26593
26615
|
beginPasskeyRegistration: () => beginPasskeyRegistration,
|
|
@@ -26597,53 +26619,53 @@ __export(auth_exports, {
|
|
|
26597
26619
|
completePasskeyAuthentication: () => completePasskeyAuthentication,
|
|
26598
26620
|
completePasskeyLinking: () => completePasskeyLinking,
|
|
26599
26621
|
completePasskeyRegistration: () => completePasskeyRegistration,
|
|
26600
|
-
configureJwtModule: () =>
|
|
26622
|
+
configureJwtModule: () => import_auth23.configureJwtModule,
|
|
26601
26623
|
createInitialAuthState: () => createInitialAuthState,
|
|
26602
|
-
createJwtTokenManager: () =>
|
|
26624
|
+
createJwtTokenManager: () => import_auth23.createJwtTokenManager,
|
|
26603
26625
|
createLoginMessage: () => createLoginMessage,
|
|
26604
26626
|
createPasskeyHelpers: () => createPasskeyHelpers,
|
|
26605
26627
|
createSignatureMessage: () => createSignatureMessage,
|
|
26606
26628
|
deriveDemoPrivateKey: () => deriveDemoPrivateKey,
|
|
26607
26629
|
ensureKeyshare: () => ensureKeyshare,
|
|
26608
|
-
ensureValidToken: () =>
|
|
26630
|
+
ensureValidToken: () => import_auth23.ensureValidToken,
|
|
26609
26631
|
fetchProjectName: () => fetchProjectName,
|
|
26610
26632
|
formatDate: () => formatDate,
|
|
26611
26633
|
getKeyshareInfo: () => getKeyshareInfo,
|
|
26612
26634
|
getLinkedProviders: () => getLinkedProviders,
|
|
26613
26635
|
getProviderDisplayInfo: () => getProviderDisplayInfo,
|
|
26614
26636
|
getTssUrl: () => getTssUrl3,
|
|
26615
|
-
getValidTokens: () =>
|
|
26637
|
+
getValidTokens: () => import_auth23.getValidTokens,
|
|
26616
26638
|
hasAvailablePasskeys: () => hasAvailablePasskeys,
|
|
26617
26639
|
hideTelegramWidget: () => hideTelegramWidget,
|
|
26618
26640
|
initTelegramWidget: () => initTelegramWidget,
|
|
26619
26641
|
isWebAuthnSupported: () => isWebAuthnSupported,
|
|
26620
|
-
jwtTokenManager: () =>
|
|
26642
|
+
jwtTokenManager: () => import_auth23.jwtTokenManager,
|
|
26621
26643
|
linkPasskeyWithWebAuthn: () => linkPasskeyWithWebAuthn,
|
|
26622
26644
|
linkTelegram: () => linkTelegram,
|
|
26623
26645
|
linkWallet: () => linkWallet,
|
|
26624
26646
|
linkX: () => linkX,
|
|
26625
|
-
loginWithEmail: () =>
|
|
26626
|
-
loginWithTelegram: () =>
|
|
26627
|
-
loginWithUserId: () =>
|
|
26647
|
+
loginWithEmail: () => import_auth23.loginWithEmail,
|
|
26648
|
+
loginWithTelegram: () => import_auth23.loginWithTelegram,
|
|
26649
|
+
loginWithUserId: () => import_auth23.loginWithUserId,
|
|
26628
26650
|
loginWithX: () => loginWithX,
|
|
26629
|
-
logout: () =>
|
|
26651
|
+
logout: () => import_auth23.logout,
|
|
26630
26652
|
mountTelegramLoginWidget: () => mountTelegramLoginWidget,
|
|
26631
26653
|
registerPasskey: () => registerPasskey,
|
|
26632
26654
|
resetWebAuthnFlags: () => resetWebAuthnFlags,
|
|
26633
26655
|
sendEmailLinkCode: () => sendEmailLinkCode,
|
|
26634
26656
|
showTelegramWidget: () => showTelegramWidget,
|
|
26635
|
-
syncKeyshareStatus: () =>
|
|
26657
|
+
syncKeyshareStatus: () => import_auth23.syncKeyshareStatus,
|
|
26636
26658
|
unlinkProvider: () => unlinkProvider,
|
|
26637
26659
|
unlinkWallet: () => unlinkWallet,
|
|
26638
26660
|
unlinkX: () => unlinkX,
|
|
26639
26661
|
verifyEmailLinkCode: () => verifyEmailLinkCode,
|
|
26640
|
-
verifyToken: () =>
|
|
26662
|
+
verifyToken: () => import_auth23.verifyToken,
|
|
26641
26663
|
walletLogin: () => walletLogin
|
|
26642
26664
|
});
|
|
26643
|
-
var
|
|
26665
|
+
var import_auth23, createInitialAuthState;
|
|
26644
26666
|
var init_auth = __esm({
|
|
26645
26667
|
"src/internal/auth/index.ts"() {
|
|
26646
|
-
|
|
26668
|
+
import_auth23 = require("@embarkai/core/auth");
|
|
26647
26669
|
init_passkeyAuth();
|
|
26648
26670
|
init_telegram();
|
|
26649
26671
|
init_passkey();
|
|
@@ -27945,13 +27967,13 @@ var init_iframe_manager = __esm({
|
|
|
27945
27967
|
});
|
|
27946
27968
|
|
|
27947
27969
|
// src/config/rainbowkit.ts
|
|
27948
|
-
var import_read21, import_rainbowkit3, import_wallets2,
|
|
27970
|
+
var import_read21, import_rainbowkit3, import_wallets2, import_wagmi10, import_chains12, getProjectId2, WALLET_MAP, getWagmiStorageKey, buildRainbowChains, createRainbowConfig, rainbowTheme;
|
|
27949
27971
|
var init_rainbowkit = __esm({
|
|
27950
27972
|
"src/config/rainbowkit.ts"() {
|
|
27951
27973
|
import_read21 = require("@embarkai/core/read");
|
|
27952
27974
|
import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
27953
27975
|
import_wallets2 = require("@rainbow-me/rainbowkit/wallets");
|
|
27954
|
-
|
|
27976
|
+
import_wagmi10 = require("wagmi");
|
|
27955
27977
|
import_chains12 = require("wagmi/chains");
|
|
27956
27978
|
getProjectId2 = (configProjectId) => {
|
|
27957
27979
|
if (configProjectId) return configProjectId;
|
|
@@ -28002,7 +28024,7 @@ var init_rainbowkit = __esm({
|
|
|
28002
28024
|
appName: "EmbarkAI Wallet",
|
|
28003
28025
|
projectId: getProjectId2(opts.projectId),
|
|
28004
28026
|
chains: buildRainbowChains(opts.supportedChains, opts.preferredChainId),
|
|
28005
|
-
storage: (0,
|
|
28027
|
+
storage: (0, import_wagmi10.createStorage)({ key: getWagmiStorageKey(opts) }),
|
|
28006
28028
|
ssr: false
|
|
28007
28029
|
};
|
|
28008
28030
|
if (opts.allowedWallets && opts.allowedWallets.length > 0) {
|
|
@@ -28203,7 +28225,7 @@ var init_rainbowkit = __esm({
|
|
|
28203
28225
|
function RainbowKitProvider({ children }) {
|
|
28204
28226
|
const config = useProviderConfig().config;
|
|
28205
28227
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28206
|
-
const rainbowConfig = (0,
|
|
28228
|
+
const rainbowConfig = (0, import_react91.useMemo)(
|
|
28207
28229
|
() => createRainbowConfig({
|
|
28208
28230
|
projectId: config.current?.wallet?.walletConnectProjectId,
|
|
28209
28231
|
allowedWallets: config.current?.wallet?.allowedWallets,
|
|
@@ -28217,7 +28239,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28217
28239
|
config.current?.wallet?.walletConnectProjectId
|
|
28218
28240
|
]
|
|
28219
28241
|
);
|
|
28220
|
-
const customTheme = (0,
|
|
28242
|
+
const customTheme = (0, import_react91.useMemo)(() => {
|
|
28221
28243
|
if (!config.current?.wallet?.enabled) return {};
|
|
28222
28244
|
return colorMode === "dark" ? {
|
|
28223
28245
|
...(0, import_rainbowkit4.darkTheme)(),
|
|
@@ -28232,14 +28254,14 @@ function RainbowKitProvider({ children }) {
|
|
|
28232
28254
|
};
|
|
28233
28255
|
}, [colorMode]);
|
|
28234
28256
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_jsx_runtime122.Fragment, { children });
|
|
28235
|
-
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 }) });
|
|
28236
28258
|
}
|
|
28237
|
-
var import_rainbowkit4,
|
|
28259
|
+
var import_rainbowkit4, import_react91, import_wagmi11, import_styles, import_jsx_runtime122;
|
|
28238
28260
|
var init_RainbowKitContext = __esm({
|
|
28239
28261
|
"src/context/RainbowKitContext.tsx"() {
|
|
28240
28262
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
28241
|
-
|
|
28242
|
-
|
|
28263
|
+
import_react91 = require("react");
|
|
28264
|
+
import_wagmi11 = require("wagmi");
|
|
28243
28265
|
init_rainbowkit();
|
|
28244
28266
|
init_useLayoutStore();
|
|
28245
28267
|
init_ProviderContext();
|
|
@@ -28264,14 +28286,14 @@ var init_utils11 = __esm({
|
|
|
28264
28286
|
});
|
|
28265
28287
|
|
|
28266
28288
|
// src/context/WagmiContext.tsx
|
|
28267
|
-
var import_core7,
|
|
28289
|
+
var import_core7, import_wagmi12, import_jsx_runtime123, WagmiProvider2;
|
|
28268
28290
|
var init_WagmiContext = __esm({
|
|
28269
28291
|
"src/context/WagmiContext.tsx"() {
|
|
28270
28292
|
import_core7 = require("@embarkai/core");
|
|
28271
|
-
|
|
28293
|
+
import_wagmi12 = require("wagmi");
|
|
28272
28294
|
import_jsx_runtime123 = require("react/jsx-runtime");
|
|
28273
28295
|
WagmiProvider2 = ({ children }) => {
|
|
28274
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
28296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_wagmi12.WagmiProvider, { config: import_core7.wagmiConfig, children });
|
|
28275
28297
|
};
|
|
28276
28298
|
}
|
|
28277
28299
|
});
|
|
@@ -28294,10 +28316,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28294
28316
|
}
|
|
28295
28317
|
function Provider(props) {
|
|
28296
28318
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28297
|
-
const callbacksRef = (0,
|
|
28298
|
-
(0,
|
|
28299
|
-
const config = (0,
|
|
28300
|
-
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) => {
|
|
28301
28323
|
const prev = config.current;
|
|
28302
28324
|
const next = { ...prev };
|
|
28303
28325
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28331,12 +28353,12 @@ function Provider(props) {
|
|
|
28331
28353
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28332
28354
|
config.current = next;
|
|
28333
28355
|
}, []);
|
|
28334
|
-
const updateCallbacks = (0,
|
|
28356
|
+
const updateCallbacks = (0, import_react92.useCallback)((updates) => {
|
|
28335
28357
|
const prev = callbacksRef.current;
|
|
28336
28358
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28337
28359
|
callbacksRef.current = next;
|
|
28338
28360
|
}, []);
|
|
28339
|
-
(0,
|
|
28361
|
+
(0, import_react92.useEffect)(() => {
|
|
28340
28362
|
if (typeof window === "undefined" || !projectId) return;
|
|
28341
28363
|
const mergedConfig = (0, import_lodash_es11.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28342
28364
|
updateConfig(mergedConfig);
|
|
@@ -28356,7 +28378,7 @@ function Provider(props) {
|
|
|
28356
28378
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28357
28379
|
}
|
|
28358
28380
|
}, [projectId, initialConfig]);
|
|
28359
|
-
(0,
|
|
28381
|
+
(0, import_react92.useEffect)(() => {
|
|
28360
28382
|
if (typeof window === "undefined" || !projectId) return;
|
|
28361
28383
|
try {
|
|
28362
28384
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -28385,7 +28407,7 @@ function Provider(props) {
|
|
|
28385
28407
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
28386
28408
|
}
|
|
28387
28409
|
}, [projectId]);
|
|
28388
|
-
const contextValue = (0,
|
|
28410
|
+
const contextValue = (0, import_react92.useMemo)(
|
|
28389
28411
|
() => ({
|
|
28390
28412
|
config,
|
|
28391
28413
|
updateConfig,
|
|
@@ -28406,12 +28428,12 @@ function Provider(props) {
|
|
|
28406
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 }) }) })
|
|
28407
28429
|
);
|
|
28408
28430
|
}
|
|
28409
|
-
var import_error_tracking4, import_lodash_es11,
|
|
28431
|
+
var import_error_tracking4, import_lodash_es11, import_react92, import_jsx_runtime124, UIContext, useProviderConfig;
|
|
28410
28432
|
var init_ProviderContext = __esm({
|
|
28411
28433
|
"src/context/ProviderContext.tsx"() {
|
|
28412
28434
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28413
28435
|
import_lodash_es11 = require("lodash-es");
|
|
28414
|
-
|
|
28436
|
+
import_react92 = require("react");
|
|
28415
28437
|
init_initial();
|
|
28416
28438
|
init_iframe_manager();
|
|
28417
28439
|
init_RainbowKitContext();
|
|
@@ -28419,9 +28441,9 @@ var init_ProviderContext = __esm({
|
|
|
28419
28441
|
init_utils11();
|
|
28420
28442
|
init_WagmiContext();
|
|
28421
28443
|
import_jsx_runtime124 = require("react/jsx-runtime");
|
|
28422
|
-
UIContext = (0,
|
|
28444
|
+
UIContext = (0, import_react92.createContext)(void 0);
|
|
28423
28445
|
useProviderConfig = () => {
|
|
28424
|
-
const ctx = (0,
|
|
28446
|
+
const ctx = (0, import_react92.useContext)(UIContext);
|
|
28425
28447
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
28426
28448
|
return ctx;
|
|
28427
28449
|
};
|
|
@@ -28463,9 +28485,9 @@ __export(index_exports, {
|
|
|
28463
28485
|
getUserOperationByHash: () => getUserOperationByHash,
|
|
28464
28486
|
getUserOperationReceipt: () => getUserOperationReceipt,
|
|
28465
28487
|
getUserProfile: () => getUserProfile,
|
|
28466
|
-
getValidTokens: () =>
|
|
28467
|
-
jwtTokenManager: () =>
|
|
28468
|
-
logout: () =>
|
|
28488
|
+
getValidTokens: () => import_auth23.getValidTokens,
|
|
28489
|
+
jwtTokenManager: () => import_auth23.jwtTokenManager,
|
|
28490
|
+
logout: () => import_auth23.logout,
|
|
28469
28491
|
looksLikeNickname: () => looksLikeNickname,
|
|
28470
28492
|
prepareBatchUserOperation: () => prepareBatchUserOperation,
|
|
28471
28493
|
prepareUserOperation: () => prepareUserOperation,
|
|
@@ -28620,7 +28642,7 @@ function EmbarkAiIcon(props) {
|
|
|
28620
28642
|
// src/components/ConnectWalletButton.tsx
|
|
28621
28643
|
var import_react_query55 = require("@tanstack/react-query");
|
|
28622
28644
|
var import_lucide_react79 = require("lucide-react");
|
|
28623
|
-
var
|
|
28645
|
+
var import_react93 = require("react");
|
|
28624
28646
|
init_SessionContext();
|
|
28625
28647
|
init_auth();
|
|
28626
28648
|
init_profile();
|
|
@@ -28653,18 +28675,18 @@ function ConnectWalletButton(props) {
|
|
|
28653
28675
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28654
28676
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28655
28677
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28656
|
-
(0,
|
|
28678
|
+
(0, import_react93.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28657
28679
|
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query55.useQuery)({
|
|
28658
28680
|
retry: false,
|
|
28659
28681
|
enabled: !!address,
|
|
28660
28682
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
28661
28683
|
queryFn: getUserProfile
|
|
28662
28684
|
});
|
|
28663
|
-
const displayName = profile?.nicknameDisplay || profile?.displayName ||
|
|
28664
|
-
const indicators = (0,
|
|
28685
|
+
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth23.jwtTokenManager.getDisplayName();
|
|
28686
|
+
const indicators = (0, import_react93.useMemo)(() => {
|
|
28665
28687
|
const userId = session?.mpcUserId;
|
|
28666
28688
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28667
|
-
const server =
|
|
28689
|
+
const server = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
28668
28690
|
const local = !!address;
|
|
28669
28691
|
return { server, local, backup: hasServerVault };
|
|
28670
28692
|
}, [session, address, hasServerVault]);
|
|
@@ -28843,7 +28865,7 @@ var useActiveChainId = () => useSession((st) => st.activeChainId);
|
|
|
28843
28865
|
var useHydrated = () => useSession((st) => st.hasHydrated);
|
|
28844
28866
|
|
|
28845
28867
|
// src/hooks/useOpenPage.ts
|
|
28846
|
-
var
|
|
28868
|
+
var import_react94 = require("react");
|
|
28847
28869
|
init_SessionContext();
|
|
28848
28870
|
init_useLayoutDataStore();
|
|
28849
28871
|
function useOpenPage() {
|
|
@@ -28851,7 +28873,7 @@ function useOpenPage() {
|
|
|
28851
28873
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
28852
28874
|
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
28853
28875
|
const address = useSession((st) => st.address);
|
|
28854
|
-
const open = (0,
|
|
28876
|
+
const open = (0, import_react94.useCallback)(
|
|
28855
28877
|
(passportPage, params) => {
|
|
28856
28878
|
if (!address) return setPage("auth" /* AUTH */);
|
|
28857
28879
|
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
@@ -28860,7 +28882,7 @@ function useOpenPage() {
|
|
|
28860
28882
|
},
|
|
28861
28883
|
[setPage, setPageParams, address]
|
|
28862
28884
|
);
|
|
28863
|
-
const close = (0,
|
|
28885
|
+
const close = (0, import_react94.useCallback)(() => setPage(null), [setPage]);
|
|
28864
28886
|
return { open, close, isOpen: page !== null };
|
|
28865
28887
|
}
|
|
28866
28888
|
|
|
@@ -29321,14 +29343,14 @@ var Hash = ({
|
|
|
29321
29343
|
};
|
|
29322
29344
|
|
|
29323
29345
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
29324
|
-
var
|
|
29346
|
+
var import_react95 = require("react");
|
|
29325
29347
|
init_base();
|
|
29326
29348
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
29327
29349
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
29328
|
-
const [transactions, setTransactions] = (0,
|
|
29329
|
-
const [loading, setLoading] = (0,
|
|
29330
|
-
const [error, setError] = (0,
|
|
29331
|
-
(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)(() => {
|
|
29332
29354
|
const fetchTransactions2 = async () => {
|
|
29333
29355
|
try {
|
|
29334
29356
|
setLoading(true);
|
|
@@ -29619,13 +29641,13 @@ function useUserOpStatus(options = {}) {
|
|
|
29619
29641
|
init_useErc3643Compliance();
|
|
29620
29642
|
|
|
29621
29643
|
// src/hooks/useWalletMode.ts
|
|
29622
|
-
var
|
|
29644
|
+
var import_react96 = require("react");
|
|
29623
29645
|
init_useExternalWalletStore();
|
|
29624
29646
|
function useWalletMode() {
|
|
29625
29647
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29626
29648
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29627
29649
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29628
|
-
const switchMode = (0,
|
|
29650
|
+
const switchMode = (0, import_react96.useCallback)(
|
|
29629
29651
|
(mode) => {
|
|
29630
29652
|
if (configMode !== "both") return;
|
|
29631
29653
|
setActiveMode(mode);
|
|
@@ -29641,9 +29663,9 @@ function useWalletMode() {
|
|
|
29641
29663
|
}
|
|
29642
29664
|
|
|
29643
29665
|
// src/hooks/useDirectWallet.ts
|
|
29644
|
-
var
|
|
29666
|
+
var import_react97 = require("react");
|
|
29645
29667
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29646
|
-
var
|
|
29668
|
+
var import_wagmi13 = require("wagmi");
|
|
29647
29669
|
init_useExternalWalletStore();
|
|
29648
29670
|
init_useLayoutDataStore();
|
|
29649
29671
|
function useDirectWallet() {
|
|
@@ -29652,16 +29674,16 @@ function useDirectWallet() {
|
|
|
29652
29674
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29653
29675
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
29654
29676
|
const clearExternalWallet = useExternalWalletStore((st) => st.clearExternalWallet);
|
|
29655
|
-
const { disconnect: wagmiDisconnect } = (0,
|
|
29677
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi13.useDisconnect)();
|
|
29656
29678
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29657
29679
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29658
|
-
const connect = (0,
|
|
29680
|
+
const connect = (0, import_react97.useCallback)(() => {
|
|
29659
29681
|
setIsWalletLinking(true);
|
|
29660
29682
|
}, [setIsWalletLinking]);
|
|
29661
|
-
const reconnect = (0,
|
|
29683
|
+
const reconnect = (0, import_react97.useCallback)(() => {
|
|
29662
29684
|
if (openConnectModal) openConnectModal();
|
|
29663
29685
|
}, [openConnectModal]);
|
|
29664
|
-
const disconnect = (0,
|
|
29686
|
+
const disconnect = (0, import_react97.useCallback)(() => {
|
|
29665
29687
|
wagmiDisconnect();
|
|
29666
29688
|
clearExternalWallet();
|
|
29667
29689
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29677,19 +29699,19 @@ function useDirectWallet() {
|
|
|
29677
29699
|
}
|
|
29678
29700
|
|
|
29679
29701
|
// src/hooks/useSendDirectTransaction.ts
|
|
29680
|
-
var
|
|
29702
|
+
var import_react98 = require("react");
|
|
29681
29703
|
var import_viem20 = require("viem");
|
|
29682
|
-
var
|
|
29704
|
+
var import_wagmi14 = require("wagmi");
|
|
29683
29705
|
init_useExternalWalletStore();
|
|
29684
29706
|
function useSendDirectTransaction() {
|
|
29685
29707
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29686
29708
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29687
|
-
const { sendTransactionAsync } = (0,
|
|
29688
|
-
const { switchChainAsync } = (0,
|
|
29689
|
-
const [isPending, setIsPending] = (0,
|
|
29690
|
-
const [error, setError] = (0,
|
|
29691
|
-
const [txHash, setTxHash] = (0,
|
|
29692
|
-
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)(
|
|
29693
29715
|
async (params) => {
|
|
29694
29716
|
if (!isConnected) {
|
|
29695
29717
|
setError("No external wallet connected");
|
|
@@ -29723,7 +29745,7 @@ function useSendDirectTransaction() {
|
|
|
29723
29745
|
},
|
|
29724
29746
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29725
29747
|
);
|
|
29726
|
-
const reset = (0,
|
|
29748
|
+
const reset = (0, import_react98.useCallback)(() => {
|
|
29727
29749
|
setError(null);
|
|
29728
29750
|
setTxHash(null);
|
|
29729
29751
|
setIsPending(false);
|
|
@@ -29732,7 +29754,7 @@ function useSendDirectTransaction() {
|
|
|
29732
29754
|
}
|
|
29733
29755
|
|
|
29734
29756
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
29735
|
-
var
|
|
29757
|
+
var import_react99 = require("react");
|
|
29736
29758
|
var import_viem21 = require("viem");
|
|
29737
29759
|
init_SessionContext();
|
|
29738
29760
|
init_account2();
|
|
@@ -29751,14 +29773,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29751
29773
|
function useTransferToLinkedWallet() {
|
|
29752
29774
|
const session = useSession((st) => st.session);
|
|
29753
29775
|
const { profiles } = useLinkedProfiles();
|
|
29754
|
-
const [isPending, setIsPending] = (0,
|
|
29755
|
-
const [error, setError] = (0,
|
|
29756
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
29757
|
-
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)(
|
|
29758
29780
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29759
29781
|
[profiles]
|
|
29760
29782
|
);
|
|
29761
|
-
const transfer = (0,
|
|
29783
|
+
const transfer = (0, import_react99.useCallback)(
|
|
29762
29784
|
async (params) => {
|
|
29763
29785
|
if (!session) {
|
|
29764
29786
|
setError("No active session");
|
|
@@ -29809,7 +29831,7 @@ function useTransferToLinkedWallet() {
|
|
|
29809
29831
|
},
|
|
29810
29832
|
[session, linkedWallets]
|
|
29811
29833
|
);
|
|
29812
|
-
const reset = (0,
|
|
29834
|
+
const reset = (0, import_react99.useCallback)(() => {
|
|
29813
29835
|
setError(null);
|
|
29814
29836
|
setUserOpHash(null);
|
|
29815
29837
|
setIsPending(false);
|
|
@@ -29818,11 +29840,11 @@ function useTransferToLinkedWallet() {
|
|
|
29818
29840
|
}
|
|
29819
29841
|
|
|
29820
29842
|
// src/hooks/useNativeWalletSignature.ts
|
|
29821
|
-
var
|
|
29843
|
+
var import_wagmi15 = require("wagmi");
|
|
29822
29844
|
init_providers();
|
|
29823
29845
|
function useNativeWalletSignature() {
|
|
29824
|
-
const signMessage = (0,
|
|
29825
|
-
const signTypedMessage = (0,
|
|
29846
|
+
const signMessage = (0, import_wagmi15.useSignMessage)();
|
|
29847
|
+
const signTypedMessage = (0, import_wagmi15.useSignTypedData)();
|
|
29826
29848
|
return {
|
|
29827
29849
|
signMessage,
|
|
29828
29850
|
/** EIP-712 signature */
|
|
@@ -29832,16 +29854,16 @@ function useNativeWalletSignature() {
|
|
|
29832
29854
|
}
|
|
29833
29855
|
|
|
29834
29856
|
// src/hooks/useLogout.ts
|
|
29835
|
-
var
|
|
29836
|
-
var
|
|
29837
|
-
var
|
|
29857
|
+
var import_auth25 = require("@embarkai/core/auth");
|
|
29858
|
+
var import_react100 = require("react");
|
|
29859
|
+
var import_wagmi16 = require("wagmi");
|
|
29838
29860
|
init_ProviderContext();
|
|
29839
29861
|
init_SessionContext();
|
|
29840
29862
|
init_useExternalWalletStore();
|
|
29841
29863
|
function useLogout() {
|
|
29842
29864
|
const { callbacksRef } = useProviderConfig();
|
|
29843
29865
|
const address = useSession((st) => st.address);
|
|
29844
|
-
const { disconnect: wagmiDisconnect } = (0,
|
|
29866
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi16.useDisconnect)({
|
|
29845
29867
|
mutation: {
|
|
29846
29868
|
onSuccess: () => {
|
|
29847
29869
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
@@ -29853,18 +29875,18 @@ function useLogout() {
|
|
|
29853
29875
|
}
|
|
29854
29876
|
}
|
|
29855
29877
|
});
|
|
29856
|
-
const logout2 = (0,
|
|
29878
|
+
const logout2 = (0, import_react100.useCallback)(async () => {
|
|
29857
29879
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
29858
29880
|
const prevAddress = address;
|
|
29859
29881
|
let userId = null;
|
|
29860
29882
|
setIsLoading(true);
|
|
29861
29883
|
try {
|
|
29862
|
-
userId =
|
|
29884
|
+
userId = import_auth25.jwtTokenManager.getUserId() || null;
|
|
29863
29885
|
} catch (error) {
|
|
29864
29886
|
console.warn("[useLogout] Could not get userId:", error);
|
|
29865
29887
|
}
|
|
29866
29888
|
try {
|
|
29867
|
-
await (0,
|
|
29889
|
+
await (0, import_auth25.logout)();
|
|
29868
29890
|
} catch (error) {
|
|
29869
29891
|
console.warn("[useLogout] Core logout failed:", error);
|
|
29870
29892
|
}
|
|
@@ -29907,13 +29929,13 @@ init_useBlockscoutAssets();
|
|
|
29907
29929
|
init_SessionContext();
|
|
29908
29930
|
var import_read22 = require("@embarkai/core/read");
|
|
29909
29931
|
var import_viem22 = require("viem");
|
|
29910
|
-
var
|
|
29932
|
+
var import_wagmi17 = require("wagmi");
|
|
29911
29933
|
function useTransactions() {
|
|
29912
29934
|
const chainId = requireActiveChainId();
|
|
29913
29935
|
const viemChain = (0, import_read22.getViemChain)(chainId);
|
|
29914
|
-
const publicClient = (0,
|
|
29915
|
-
const { data: walletClient } = (0,
|
|
29916
|
-
const { address } = (0,
|
|
29936
|
+
const publicClient = (0, import_wagmi17.usePublicClient)({ chainId });
|
|
29937
|
+
const { data: walletClient } = (0, import_wagmi17.useWalletClient)();
|
|
29938
|
+
const { address } = (0, import_wagmi17.useAccount)();
|
|
29917
29939
|
const sendTransaction = async (params) => {
|
|
29918
29940
|
if (!walletClient) {
|
|
29919
29941
|
throw new Error("Wallet not connected");
|
|
@@ -29971,9 +29993,9 @@ function useTransactions() {
|
|
|
29971
29993
|
|
|
29972
29994
|
// src/modules/assets.ts
|
|
29973
29995
|
init_SessionContext();
|
|
29974
|
-
var
|
|
29996
|
+
var import_react101 = __toESM(require("react"), 1);
|
|
29975
29997
|
var import_viem23 = require("viem");
|
|
29976
|
-
var
|
|
29998
|
+
var import_wagmi18 = require("wagmi");
|
|
29977
29999
|
var COMMON_TOKENS = [
|
|
29978
30000
|
// Add real token addresses here when available
|
|
29979
30001
|
// {
|
|
@@ -29990,7 +30012,7 @@ function useAssets(address) {
|
|
|
29990
30012
|
data: nativeBalance,
|
|
29991
30013
|
isLoading: nativeBalanceLoading,
|
|
29992
30014
|
refetch: refetchNativeBalance
|
|
29993
|
-
} = (0,
|
|
30015
|
+
} = (0, import_wagmi18.useBalance)({
|
|
29994
30016
|
address,
|
|
29995
30017
|
chainId,
|
|
29996
30018
|
query: {
|
|
@@ -30004,7 +30026,7 @@ function useAssets(address) {
|
|
|
30004
30026
|
args: [address],
|
|
30005
30027
|
chainId
|
|
30006
30028
|
}));
|
|
30007
|
-
const readContractsResult = (0,
|
|
30029
|
+
const readContractsResult = (0, import_wagmi18.useReadContracts)({
|
|
30008
30030
|
contracts: tokenContracts,
|
|
30009
30031
|
query: {
|
|
30010
30032
|
enabled: !!address && COMMON_TOKENS.length > 0
|
|
@@ -30085,7 +30107,7 @@ function useAssets(address) {
|
|
|
30085
30107
|
}
|
|
30086
30108
|
function useTokenInfo(tokenAddress) {
|
|
30087
30109
|
const chainId = requireActiveChainId();
|
|
30088
|
-
const readContractsResult = (0,
|
|
30110
|
+
const readContractsResult = (0, import_wagmi18.useReadContracts)({
|
|
30089
30111
|
contracts: [
|
|
30090
30112
|
{ address: tokenAddress, abi: import_viem23.erc20Abi, functionName: "name", chainId },
|
|
30091
30113
|
{ address: tokenAddress, abi: import_viem23.erc20Abi, functionName: "symbol", chainId },
|
|
@@ -30116,7 +30138,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
30116
30138
|
data: balance,
|
|
30117
30139
|
isLoading,
|
|
30118
30140
|
refetch
|
|
30119
|
-
} = (0,
|
|
30141
|
+
} = (0, import_wagmi18.useReadContract)({
|
|
30120
30142
|
address: tokenAddress,
|
|
30121
30143
|
abi: import_viem23.erc20Abi,
|
|
30122
30144
|
functionName: "balanceOf",
|
|
@@ -30127,7 +30149,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
30127
30149
|
}
|
|
30128
30150
|
});
|
|
30129
30151
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
30130
|
-
const formattedBalance =
|
|
30152
|
+
const formattedBalance = import_react101.default.useMemo(() => {
|
|
30131
30153
|
if (!balance || !tokenInfo) return "0";
|
|
30132
30154
|
return (0, import_viem23.formatUnits)(balance, tokenInfo.decimals);
|
|
30133
30155
|
}, [balance, tokenInfo]);
|