@embarkai/ui-kit 0.4.45 → 0.4.47
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 +369 -355
- package/dist/index.js +325 -311
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1301,7 +1301,7 @@ var init_ChainSync2 = __esm({
|
|
|
1301
1301
|
|
|
1302
1302
|
// src/internal/clients/account/register-smart-account-address.ts
|
|
1303
1303
|
async function registerSmartAccountAddress(chainId, smartAccountAddress, factoryAddress) {
|
|
1304
|
-
const accessToken =
|
|
1304
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
1305
1305
|
if (!accessToken) {
|
|
1306
1306
|
console.warn("[Account] No access token available for Smart Account registration");
|
|
1307
1307
|
return { success: true, chainId, smartAccountAddress, alreadySet: false };
|
|
@@ -1346,7 +1346,7 @@ async function registerSmartAccountAddress(chainId, smartAccountAddress, factory
|
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
1348
|
async function getAllSmartAccounts() {
|
|
1349
|
-
const accessToken =
|
|
1349
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
1350
1350
|
if (!accessToken) {
|
|
1351
1351
|
console.warn("[Account] No access token available");
|
|
1352
1352
|
return [];
|
|
@@ -1373,7 +1373,7 @@ async function getAllSmartAccounts() {
|
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
1375
|
async function getSmartAccountForChain(chainId) {
|
|
1376
|
-
const accessToken =
|
|
1376
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
1377
1377
|
if (!accessToken) {
|
|
1378
1378
|
console.warn("[Account] No access token available");
|
|
1379
1379
|
return null;
|
|
@@ -1989,7 +1989,7 @@ var init_httpClient = __esm({
|
|
|
1989
1989
|
...headers
|
|
1990
1990
|
};
|
|
1991
1991
|
if (requireAuth) {
|
|
1992
|
-
const accessToken =
|
|
1992
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
1993
1993
|
if (accessToken) {
|
|
1994
1994
|
requestHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
1995
1995
|
}
|
|
@@ -2006,9 +2006,9 @@ var init_httpClient = __esm({
|
|
|
2006
2006
|
try {
|
|
2007
2007
|
const response = await fetch(url, requestConfig);
|
|
2008
2008
|
if (response.status === 401 && requireAuth) {
|
|
2009
|
-
const refreshSuccess = await
|
|
2009
|
+
const refreshSuccess = await import_auth21.jwtTokenManager.refreshAccessToken();
|
|
2010
2010
|
if (refreshSuccess) {
|
|
2011
|
-
const newAccessToken =
|
|
2011
|
+
const newAccessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
2012
2012
|
if (newAccessToken) {
|
|
2013
2013
|
requestHeaders["Authorization"] = `Bearer ${newAccessToken}`;
|
|
2014
2014
|
requestConfig.headers = requestHeaders;
|
|
@@ -2441,15 +2441,11 @@ function useBackupStatusChanges() {
|
|
|
2441
2441
|
onSuccess: ({ stats, detail }) => {
|
|
2442
2442
|
const hasRecoveryData = stats && (!!stats.created || !!stats?.devices?.length);
|
|
2443
2443
|
if (!!hasRecoveryData) {
|
|
2444
|
-
console.log(
|
|
2445
|
-
"[BACKUP STATUS] Recovery data found after backup status change.\n Redirect to main menu:",
|
|
2446
|
-
detail?.navigateToMainMenu
|
|
2447
|
-
);
|
|
2448
2444
|
setHasServerVault(true);
|
|
2449
|
-
if (!!detail?.
|
|
2450
|
-
|
|
2445
|
+
if (!!detail?.navigateToNicknameMenu) {
|
|
2446
|
+
console.log("[BACKUP STATUS] New user backup created, navigating to nickname settings");
|
|
2447
|
+
setTimeout(() => setPage("nickname-settings" /* NICKNAME_SETTINGS */), 1e3);
|
|
2451
2448
|
}
|
|
2452
|
-
console.info("[BACKUP STATUS] Recovery data found in vault, marking as has-server-vault");
|
|
2453
2449
|
} else {
|
|
2454
2450
|
setHasServerVault(false);
|
|
2455
2451
|
setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
@@ -6640,7 +6636,7 @@ function PassKeyStep(props) {
|
|
|
6640
6636
|
setPasskeyStatus("checking available passkeys...");
|
|
6641
6637
|
setIsLoading(true);
|
|
6642
6638
|
try {
|
|
6643
|
-
|
|
6639
|
+
import_auth21.jwtTokenManager.clearTokens();
|
|
6644
6640
|
setPasskeyStatus("authenticating with passkey...");
|
|
6645
6641
|
const result = await authenticateWithPasskey(
|
|
6646
6642
|
void 0,
|
|
@@ -7131,8 +7127,8 @@ function Social(props) {
|
|
|
7131
7127
|
const iframeManager = getIframeManager2();
|
|
7132
7128
|
const finalizeSocialLogin = async (rawLoginResponse, providerKey, userData) => {
|
|
7133
7129
|
let loginResponse2 = await normalizeSocialLoginResponse(rawLoginResponse, providerKey, userData);
|
|
7134
|
-
const existingAccessToken =
|
|
7135
|
-
const existingRefreshToken =
|
|
7130
|
+
const existingAccessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
7131
|
+
const existingRefreshToken = import_auth21.jwtTokenManager.getRefreshToken();
|
|
7136
7132
|
if (existingAccessToken && existingRefreshToken && !loginResponse2.accessToken) {
|
|
7137
7133
|
console.log("[AuthModal] Using tokens already stored by iframe-manager");
|
|
7138
7134
|
loginResponse2 = {
|
|
@@ -7161,7 +7157,7 @@ function Social(props) {
|
|
|
7161
7157
|
setIsLoading(false);
|
|
7162
7158
|
return;
|
|
7163
7159
|
}
|
|
7164
|
-
await
|
|
7160
|
+
await import_auth21.jwtTokenManager.clearTokens();
|
|
7165
7161
|
if (!loginResponse2.accessToken || !loginResponse2.refreshToken) {
|
|
7166
7162
|
console.warn(
|
|
7167
7163
|
"[AuthModal] Authentication tokens were not issued; continuing with cookie-based session only."
|
|
@@ -7170,7 +7166,7 @@ function Social(props) {
|
|
|
7170
7166
|
let tokensPersisted = false;
|
|
7171
7167
|
const persistTokensIfAvailable = async () => {
|
|
7172
7168
|
if (!tokensPersisted && loginResponse2.accessToken && loginResponse2.refreshToken) {
|
|
7173
|
-
await
|
|
7169
|
+
await import_auth21.jwtTokenManager.setTokens(loginResponse2);
|
|
7174
7170
|
tokensPersisted = true;
|
|
7175
7171
|
}
|
|
7176
7172
|
};
|
|
@@ -7607,25 +7603,15 @@ function useAuthMenuHandlers() {
|
|
|
7607
7603
|
const { config, callbacksRef } = useProviderConfig();
|
|
7608
7604
|
const qc = (0, import_react_query5.useQueryClient)();
|
|
7609
7605
|
const pendingLoginResponseRef = (0, import_react15.useRef)(null);
|
|
7610
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
7611
|
-
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
7612
7606
|
const [telegramCleanup, setTelegramCleanup] = (0, import_react15.useState)(null);
|
|
7613
|
-
const
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
activeChainId,
|
|
7617
|
-
setError,
|
|
7618
|
-
setStatus,
|
|
7619
|
-
setSession,
|
|
7620
|
-
setAddress,
|
|
7621
|
-
setRecoveryUserId,
|
|
7622
|
-
setHasServerVault,
|
|
7623
|
-
setIsLoading
|
|
7624
|
-
} = useSession();
|
|
7607
|
+
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
7608
|
+
const publicClient = useSession((st) => st.publicClient);
|
|
7609
|
+
const activeChainId = useSession((st) => st.activeChainId);
|
|
7625
7610
|
const setStep = useAuthStore((st) => st.setStep);
|
|
7626
7611
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7627
7612
|
const createSessionWithKeyshare = (0, import_react15.useCallback)(
|
|
7628
7613
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
7614
|
+
const { setStatus } = useSession.getState();
|
|
7629
7615
|
try {
|
|
7630
7616
|
try {
|
|
7631
7617
|
callbacksRef.current?.onConnecting?.({ method: "wallet" });
|
|
@@ -7663,9 +7649,19 @@ function useAuthMenuHandlers() {
|
|
|
7663
7649
|
throw error;
|
|
7664
7650
|
}
|
|
7665
7651
|
},
|
|
7666
|
-
[
|
|
7652
|
+
[usePaymaster, activeChainId]
|
|
7667
7653
|
);
|
|
7668
7654
|
const onAuthSuccess = (0, import_react15.useCallback)(async () => {
|
|
7655
|
+
const {
|
|
7656
|
+
//
|
|
7657
|
+
setSession,
|
|
7658
|
+
setAddress,
|
|
7659
|
+
setStatus,
|
|
7660
|
+
setIsLoading,
|
|
7661
|
+
setError,
|
|
7662
|
+
setHasServerVault,
|
|
7663
|
+
setRecoveryUserId
|
|
7664
|
+
} = useSession.getState();
|
|
7669
7665
|
setIsLoading(true);
|
|
7670
7666
|
setStep("loading");
|
|
7671
7667
|
const loginResponse = pendingLoginResponseRef.current;
|
|
@@ -7683,7 +7679,7 @@ function useAuthMenuHandlers() {
|
|
|
7683
7679
|
const iframeManager = getIframeManager2();
|
|
7684
7680
|
await iframeManager.authenticate(userId, loginResponse.avatar, loginResponse.displayName);
|
|
7685
7681
|
if (loginResponse.accessToken && loginResponse.refreshToken) {
|
|
7686
|
-
await
|
|
7682
|
+
await import_auth21.jwtTokenManager.setTokens(loginResponse);
|
|
7687
7683
|
} else {
|
|
7688
7684
|
console.warn("[ConnectWalletButton] Login response missing tokens; skipping jwtTokenManager.setTokens");
|
|
7689
7685
|
}
|
|
@@ -7729,11 +7725,11 @@ function useAuthMenuHandlers() {
|
|
|
7729
7725
|
if (!!jwt?.isNewUser || !hasKeyshareVaultBackup) {
|
|
7730
7726
|
if (!!jwt?.isNewUser) console.log("[AuthMenu] New user detected - forcing backup flow");
|
|
7731
7727
|
if (!hasKeyshareVaultBackup) console.log("[AuthMenu] No recovery data found - forcing backup flow");
|
|
7732
|
-
setIsDialogForced(true);
|
|
7733
|
-
setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
7728
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
7729
|
+
useLayoutDataStore.getState().setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
7734
7730
|
} else {
|
|
7735
|
-
setIsDialogForced(false);
|
|
7736
|
-
setPage(null);
|
|
7731
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
7732
|
+
useLayoutDataStore.getState().setPage(null);
|
|
7737
7733
|
}
|
|
7738
7734
|
}, 100);
|
|
7739
7735
|
} catch (error) {
|
|
@@ -7745,12 +7741,10 @@ function useAuthMenuHandlers() {
|
|
|
7745
7741
|
setAddress(null);
|
|
7746
7742
|
setRecoveryUserId(userId);
|
|
7747
7743
|
setStatus("recovery_needed");
|
|
7748
|
-
setTimeout(() =>
|
|
7749
|
-
setPage("keyshare-restore" /* KEYSHARE_RESTORE */);
|
|
7750
|
-
}, 100);
|
|
7744
|
+
setTimeout(() => useLayoutDataStore.getState().setPage("keyshare-restore" /* KEYSHARE_RESTORE */), 100);
|
|
7751
7745
|
} else {
|
|
7752
7746
|
pendingLoginResponseRef.current = null;
|
|
7753
|
-
await
|
|
7747
|
+
await import_auth21.jwtTokenManager.clearTokens();
|
|
7754
7748
|
setStatus("error");
|
|
7755
7749
|
setError(error?.message || String(error));
|
|
7756
7750
|
setAlert({
|
|
@@ -7763,20 +7757,7 @@ function useAuthMenuHandlers() {
|
|
|
7763
7757
|
setIsLoading(false);
|
|
7764
7758
|
setStep("signin");
|
|
7765
7759
|
}
|
|
7766
|
-
}, [
|
|
7767
|
-
qc,
|
|
7768
|
-
setStep,
|
|
7769
|
-
setPage,
|
|
7770
|
-
setError,
|
|
7771
|
-
setStatus,
|
|
7772
|
-
setSession,
|
|
7773
|
-
setAlert,
|
|
7774
|
-
setAddress,
|
|
7775
|
-
setRecoveryUserId,
|
|
7776
|
-
setHasServerVault,
|
|
7777
|
-
setIsDialogForced,
|
|
7778
|
-
createSessionWithKeyshare
|
|
7779
|
-
]);
|
|
7760
|
+
}, [qc, setStep, setAlert, createSessionWithKeyshare]);
|
|
7780
7761
|
const goBackToSignIn = (0, import_react15.useCallback)(() => {
|
|
7781
7762
|
setStep("signin");
|
|
7782
7763
|
setAlert(null);
|
|
@@ -8209,7 +8190,7 @@ var init_AuthMenu = __esm({
|
|
|
8209
8190
|
const loginResponse = pendingWalletLogin;
|
|
8210
8191
|
setPendingWalletLogin(null);
|
|
8211
8192
|
console.log("[AuthMenu] Processing wallet login response:", loginResponse);
|
|
8212
|
-
|
|
8193
|
+
import_auth21.jwtTokenManager.clearTokens().then(() => {
|
|
8213
8194
|
pendingLoginResponseRef.current = loginResponse;
|
|
8214
8195
|
onAuthSuccess();
|
|
8215
8196
|
});
|
|
@@ -9479,7 +9460,7 @@ var init_queryKeys = __esm({
|
|
|
9479
9460
|
|
|
9480
9461
|
// src/internal/components/BuyMenu/binance/api.ts
|
|
9481
9462
|
function iframe() {
|
|
9482
|
-
const accessToken =
|
|
9463
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
9483
9464
|
if (!accessToken) {
|
|
9484
9465
|
throw new Error("Access token is not available");
|
|
9485
9466
|
}
|
|
@@ -9581,6 +9562,7 @@ var init_networks = __esm({
|
|
|
9581
9562
|
// src/internal/components/BuyMenu/binance/BinanceSummary.tsx
|
|
9582
9563
|
function BinanceSummary(props) {
|
|
9583
9564
|
const { payment } = props;
|
|
9565
|
+
const qc = (0, import_react_query7.useQueryClient)();
|
|
9584
9566
|
const { t } = useT();
|
|
9585
9567
|
const walletAddress = useSession((st) => st.address);
|
|
9586
9568
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
@@ -9599,10 +9581,10 @@ function BinanceSummary(props) {
|
|
|
9599
9581
|
network: CHAIN_ID_TO_BINANCE_NETWORK_NAMES[chainConfig.id],
|
|
9600
9582
|
payMethodCode: payment?.payMethodCode || void 0,
|
|
9601
9583
|
payMethodSubCode: payment?.payMethodSubCode || void 0,
|
|
9602
|
-
// redirectUrl: returnUrl,
|
|
9603
|
-
// failRedirectUrl: returnUrl,
|
|
9604
9584
|
// TODO: pass quote response to backend to create order with exact quote details (amount, fees, etc.)
|
|
9605
9585
|
quote: quoteData
|
|
9586
|
+
// redirectUrl: returnUrl,
|
|
9587
|
+
// failRedirectUrl: returnUrl,
|
|
9606
9588
|
});
|
|
9607
9589
|
},
|
|
9608
9590
|
onSuccess: (response) => {
|
|
@@ -9613,6 +9595,7 @@ function BinanceSummary(props) {
|
|
|
9613
9595
|
} else {
|
|
9614
9596
|
setTimeout(() => {
|
|
9615
9597
|
setRedirecting(false);
|
|
9598
|
+
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
|
|
9616
9599
|
window.open(link, "_blank", "noopener,noreferrer");
|
|
9617
9600
|
useBuyMenuStore.getState().setError(null);
|
|
9618
9601
|
useBuyMenuStore.getState().setIsTransactionHistory(true);
|
|
@@ -9622,6 +9605,7 @@ function BinanceSummary(props) {
|
|
|
9622
9605
|
onError: (err) => {
|
|
9623
9606
|
setRedirecting(false);
|
|
9624
9607
|
console.error("[BINANCE] Create Checkout Order failed", err);
|
|
9608
|
+
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
|
|
9625
9609
|
}
|
|
9626
9610
|
});
|
|
9627
9611
|
const isContinueDisabled = !!redirecting || !!isFundWalletOrderCheckouting || !quoteData;
|
|
@@ -9703,6 +9687,7 @@ var init_BinanceSummary = __esm({
|
|
|
9703
9687
|
init_button();
|
|
9704
9688
|
init_highlight();
|
|
9705
9689
|
init_contants();
|
|
9690
|
+
init_queryKeys();
|
|
9706
9691
|
init_useBuyMenuStore();
|
|
9707
9692
|
init_api();
|
|
9708
9693
|
init_networks();
|
|
@@ -9947,31 +9932,40 @@ function BinanceTxHistoryItem(props) {
|
|
|
9947
9932
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "w-full flex items-start gap-[var(--ui-kit-gap)] mb-1", children: [
|
|
9948
9933
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TokenIcon, { className: "w-8 h-8" }),
|
|
9949
9934
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "w-full", children: [
|
|
9935
|
+
Number(fiatAmount || "0") > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "text-[10px] leading-3", children: [
|
|
9936
|
+
formatPrice(Number(fiatAmount)),
|
|
9937
|
+
" ",
|
|
9938
|
+
fiatCurrency
|
|
9939
|
+
] }),
|
|
9950
9940
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "text-lg leading-5", children: [
|
|
9951
9941
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("strong", { children: formatPrice(Number(cryptoAmount)) }),
|
|
9952
9942
|
" ",
|
|
9953
9943
|
cryptoCurrency
|
|
9954
|
-
] }),
|
|
9955
|
-
Number(fiatAmount || "0") > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "text-[10px] leading-4", children: [
|
|
9956
|
-
formatPrice(Number(fiatAmount)),
|
|
9957
|
-
" ",
|
|
9958
|
-
fiatCurrency
|
|
9959
9944
|
] })
|
|
9960
9945
|
] })
|
|
9961
9946
|
] }),
|
|
9962
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)] justify-between
|
|
9963
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className:
|
|
9947
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)] justify-between leading-4", children: [
|
|
9948
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "flex-none whitespace-nowrap text-[10px] text-[var(--ui-kit-fg-muted)]", children: [
|
|
9964
9949
|
"ID: ",
|
|
9965
9950
|
id
|
|
9966
9951
|
] }),
|
|
9967
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
9952
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
9953
|
+
"span",
|
|
9954
|
+
{
|
|
9955
|
+
className: cn(
|
|
9956
|
+
"whitespace-nowrap overflow-hidden text-ellipsis",
|
|
9957
|
+
"block flex-1 text-[10px] text-right text-[var(--ui-kit-fg-muted)]"
|
|
9958
|
+
),
|
|
9959
|
+
children: (0, import_dayjs.default)(updatedAt || createdAt).format("MMM D YYYY [at] HH:mm")
|
|
9960
|
+
}
|
|
9961
|
+
)
|
|
9968
9962
|
] }),
|
|
9969
9963
|
orderDetailLink && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
9970
9964
|
Button,
|
|
9971
9965
|
{
|
|
9972
9966
|
variant: "outline",
|
|
9973
9967
|
size: "medium",
|
|
9974
|
-
className: "w-full",
|
|
9968
|
+
className: "w-full mt-1",
|
|
9975
9969
|
onClick: () => window.open(orderDetailLink, "_blank", "noopener,noreferrer"),
|
|
9976
9970
|
children: [
|
|
9977
9971
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react13.ExternalLinkIcon, { className: "w-4 h-4" }),
|
|
@@ -10021,7 +10015,7 @@ function BinanceTxHistory() {
|
|
|
10021
10015
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Highlight, { children: t("passport:buyMenu.noItems.noTransactions") });
|
|
10022
10016
|
}
|
|
10023
10017
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
10024
|
-
txList.map((tx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BinanceTxHistoryItem, { ...tx }, tx.id)),
|
|
10018
|
+
isTxDataLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react13.LoaderIcon, { className: "w-4 h-4 animate-spin" }) }) : txList.map((tx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BinanceTxHistoryItem, { ...tx }, tx.id)),
|
|
10025
10019
|
hasNextPage && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
10026
10020
|
Button,
|
|
10027
10021
|
{
|
|
@@ -10076,7 +10070,7 @@ function useBinanceSseTxTracing(walletAddress) {
|
|
|
10076
10070
|
if (data?.type !== "ORDER_UPDATED") return;
|
|
10077
10071
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
10078
10072
|
debounceRef.current = setTimeout(() => {
|
|
10079
|
-
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions
|
|
10073
|
+
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
|
|
10080
10074
|
}, 500);
|
|
10081
10075
|
}) || null;
|
|
10082
10076
|
connectTxTracing({ walletAddress }).catch(
|
|
@@ -10378,7 +10372,7 @@ var init_binance = __esm({
|
|
|
10378
10372
|
|
|
10379
10373
|
// src/internal/components/BuyMenu/finchpay/api.ts
|
|
10380
10374
|
function iframe2() {
|
|
10381
|
-
const accessToken =
|
|
10375
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
10382
10376
|
if (!accessToken) {
|
|
10383
10377
|
throw new Error("Access token is not available");
|
|
10384
10378
|
}
|
|
@@ -11620,67 +11614,43 @@ var init_LumiaIcon2 = __esm({
|
|
|
11620
11614
|
}
|
|
11621
11615
|
});
|
|
11622
11616
|
|
|
11623
|
-
// src/
|
|
11624
|
-
var import_read11,
|
|
11617
|
+
// src/internal/assets/networks/index.ts
|
|
11618
|
+
var import_read11, NETWORKS_ICONS;
|
|
11625
11619
|
var init_networks3 = __esm({
|
|
11626
|
-
"src/
|
|
11620
|
+
"src/internal/assets/networks/index.ts"() {
|
|
11621
|
+
import_read11 = require("@embarkai/core/read");
|
|
11627
11622
|
init_ArbitrumIcon();
|
|
11628
11623
|
init_BaseIcon();
|
|
11629
11624
|
init_BscIcon();
|
|
11630
11625
|
init_EthereumIcon();
|
|
11631
11626
|
init_LumiaIcon2();
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
Icon: BSCIcon,
|
|
11660
|
-
isActive: true
|
|
11661
|
-
},
|
|
11662
|
-
{
|
|
11663
|
-
chainId: import_read11.ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
11664
|
-
name: "Arbitrum Sepolia",
|
|
11665
|
-
badge: "TESTNET",
|
|
11666
|
-
Icon: ArbitrumIcon,
|
|
11667
|
-
isActive: true
|
|
11668
|
-
},
|
|
11669
|
-
{
|
|
11670
|
-
chainId: import_read11.BASE_SEPOLIA_CHAIN_ID,
|
|
11671
|
-
name: "Base Sepolia",
|
|
11672
|
-
badge: "TESTNET",
|
|
11673
|
-
Icon: BaseIcon,
|
|
11674
|
-
isActive: true
|
|
11675
|
-
},
|
|
11676
|
-
{
|
|
11677
|
-
chainId: import_read11.LUMIA_PULSAR_TESTNET_CHAIN_ID,
|
|
11678
|
-
name: "Lumia Pulsar Testnet",
|
|
11679
|
-
badge: "TESTNET",
|
|
11680
|
-
Icon: LumiaIcon2,
|
|
11681
|
-
isActive: true
|
|
11682
|
-
}
|
|
11683
|
-
];
|
|
11627
|
+
NETWORKS_ICONS = {
|
|
11628
|
+
[import_read11.LUMIA_MAINNET_CHAIN_ID]: LumiaIcon2,
|
|
11629
|
+
[import_read11.LUMIA_TESTNET_CHAIN_ID]: LumiaIcon2,
|
|
11630
|
+
[import_read11.LUMIA_PULSAR_TESTNET_CHAIN_ID]: LumiaIcon2,
|
|
11631
|
+
[import_read11.BASE_SEPOLIA_CHAIN_ID]: BaseIcon,
|
|
11632
|
+
[import_read11.BSC_MAINNET_CHAIN_ID]: BSCIcon,
|
|
11633
|
+
[import_read11.BSC_TESTNET_CHAIN_ID]: BSCIcon,
|
|
11634
|
+
1: EthereumIcon,
|
|
11635
|
+
[import_read11.ARBITRUM_SEPOLIA_CHAIN_ID]: ArbitrumIcon
|
|
11636
|
+
};
|
|
11637
|
+
}
|
|
11638
|
+
});
|
|
11639
|
+
|
|
11640
|
+
// src/config/networks.ts
|
|
11641
|
+
var import_read12, NETWORK_OPTIONS;
|
|
11642
|
+
var init_networks4 = __esm({
|
|
11643
|
+
"src/config/networks.ts"() {
|
|
11644
|
+
init_networks3();
|
|
11645
|
+
init_EmbarkIcon();
|
|
11646
|
+
import_read12 = require("@embarkai/core/read");
|
|
11647
|
+
NETWORK_OPTIONS = [...import_read12.SUPPORTED_CHAINS].map(([chainId, chain]) => ({
|
|
11648
|
+
chainId,
|
|
11649
|
+
name: chain.name,
|
|
11650
|
+
badge: import_read12.SUPPORTED_MAINNETS.includes(chainId) ? "MAINNET" : "TESTNET",
|
|
11651
|
+
Icon: NETWORKS_ICONS[chainId] || EmbarkIcon,
|
|
11652
|
+
isActive: true
|
|
11653
|
+
}));
|
|
11684
11654
|
}
|
|
11685
11655
|
});
|
|
11686
11656
|
|
|
@@ -11712,7 +11682,7 @@ var init_truncateMiddle = __esm({
|
|
|
11712
11682
|
|
|
11713
11683
|
// src/internal/components/ChainsMenu/ChainsMenu.tsx
|
|
11714
11684
|
function getPaymasterExplorerUrl(chainId, paymasterAddress) {
|
|
11715
|
-
const chainConfig = (0,
|
|
11685
|
+
const chainConfig = (0, import_read13.getChainConfig)(chainId);
|
|
11716
11686
|
const explorerUrl = chainConfig?.blockExplorerUrl;
|
|
11717
11687
|
if (!explorerUrl) return paymasterAddress;
|
|
11718
11688
|
return `${explorerUrl.replace(/\/$/, "")}/address/${paymasterAddress}`;
|
|
@@ -11729,7 +11699,7 @@ function ChainsMenu() {
|
|
|
11729
11699
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11730
11700
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11731
11701
|
const visibleNetworks = NETWORK_OPTIONS.filter((option) => option.isActive);
|
|
11732
|
-
const activeChainConfig = activeChainId ? (0,
|
|
11702
|
+
const activeChainConfig = activeChainId ? (0, import_read13.getChainConfig)(activeChainId) : null;
|
|
11733
11703
|
const activeDefaultPaymasterAddress = activeChainConfig?.paymasterAddress;
|
|
11734
11704
|
const activePaymasterQuery = (0, import_react_query15.useQuery)({
|
|
11735
11705
|
queryKey: ["chain-paymaster", config.current.projectId, activeChainId],
|
|
@@ -11870,15 +11840,15 @@ function ChainsMenu() {
|
|
|
11870
11840
|
}
|
|
11871
11841
|
);
|
|
11872
11842
|
}
|
|
11873
|
-
var import_core2,
|
|
11843
|
+
var import_core2, import_read13, import_react_query15, import_lucide_react19, import_react29, import_jsx_runtime48;
|
|
11874
11844
|
var init_ChainsMenu = __esm({
|
|
11875
11845
|
"src/internal/components/ChainsMenu/ChainsMenu.tsx"() {
|
|
11876
|
-
|
|
11846
|
+
init_networks4();
|
|
11877
11847
|
init_ProviderContext();
|
|
11878
11848
|
init_SessionContext();
|
|
11879
11849
|
init_useT();
|
|
11880
11850
|
import_core2 = require("@embarkai/core");
|
|
11881
|
-
|
|
11851
|
+
import_read13 = require("@embarkai/core/read");
|
|
11882
11852
|
import_react_query15 = require("@tanstack/react-query");
|
|
11883
11853
|
import_lucide_react19 = require("lucide-react");
|
|
11884
11854
|
import_react29 = require("react");
|
|
@@ -11980,7 +11950,7 @@ function ChainSwitchRequest() {
|
|
|
11980
11950
|
var import_lucide_react20, import_react30, import_react_i18next2, import_jsx_runtime49;
|
|
11981
11951
|
var init_ChainSwitchRequest = __esm({
|
|
11982
11952
|
"src/internal/components/ChainsMenu/ChainSwitchRequest.tsx"() {
|
|
11983
|
-
|
|
11953
|
+
init_networks4();
|
|
11984
11954
|
init_ProviderContext();
|
|
11985
11955
|
init_SessionContext();
|
|
11986
11956
|
init_useT();
|
|
@@ -13428,9 +13398,9 @@ __export(passkey_exports2, {
|
|
|
13428
13398
|
linkPasskeyWithWebAuthn: () => linkPasskeyWithWebAuthn
|
|
13429
13399
|
});
|
|
13430
13400
|
async function completePasskeyLinking(payload) {
|
|
13431
|
-
const hasValidToken = await (0,
|
|
13401
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
13432
13402
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
13433
|
-
const response = await (0,
|
|
13403
|
+
const response = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/complete`, {
|
|
13434
13404
|
method: "POST",
|
|
13435
13405
|
body: JSON.stringify(payload)
|
|
13436
13406
|
});
|
|
@@ -13440,9 +13410,9 @@ async function completePasskeyLinking(payload) {
|
|
|
13440
13410
|
}
|
|
13441
13411
|
}
|
|
13442
13412
|
async function beginPasskeyLinking() {
|
|
13443
|
-
const hasValidToken = await (0,
|
|
13413
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
13444
13414
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
13445
|
-
let res = await (0,
|
|
13415
|
+
let res = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/begin`, { method: "POST" });
|
|
13446
13416
|
if (res.ok) {
|
|
13447
13417
|
const begin2 = await res.json();
|
|
13448
13418
|
const options2 = {
|
|
@@ -13470,7 +13440,7 @@ async function beginPasskeyLinking() {
|
|
|
13470
13440
|
};
|
|
13471
13441
|
return { challengeId: begin2.challengeId, options: options2 };
|
|
13472
13442
|
}
|
|
13473
|
-
res = await (0,
|
|
13443
|
+
res = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/options`, { method: "GET" });
|
|
13474
13444
|
if (!res.ok) throw new Error("Failed to get passkey linking options");
|
|
13475
13445
|
const begin = await res.json();
|
|
13476
13446
|
const options = {
|
|
@@ -13502,7 +13472,7 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
13502
13472
|
if (!("credentials" in navigator) || !("create" in navigator.credentials)) {
|
|
13503
13473
|
throw new Error("WebAuthn not supported in this browser");
|
|
13504
13474
|
}
|
|
13505
|
-
const userId =
|
|
13475
|
+
const userId = import_auth21.jwtTokenManager.getUserId();
|
|
13506
13476
|
if (!userId) throw new Error("No authenticated user");
|
|
13507
13477
|
let challengeId = null;
|
|
13508
13478
|
let publicKeyOptions = null;
|
|
@@ -13798,36 +13768,39 @@ function useCreateBackup() {
|
|
|
13798
13768
|
const session = useSession((st) => st.session);
|
|
13799
13769
|
const address = useSession((st) => st.address);
|
|
13800
13770
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
13801
|
-
const
|
|
13802
|
-
const
|
|
13771
|
+
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13772
|
+
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13773
|
+
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13803
13774
|
(0, import_react36.useEffect)(() => {
|
|
13804
13775
|
if (!hasServerVault) {
|
|
13805
|
-
setMethod("server");
|
|
13806
|
-
setIsDialogForced(true);
|
|
13776
|
+
useRestoreStore.getState().setMethod("server");
|
|
13777
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
13807
13778
|
}
|
|
13808
|
-
}, [hasServerVault
|
|
13779
|
+
}, [hasServerVault]);
|
|
13809
13780
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13810
13781
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13811
|
-
const onBackupSuccess = (
|
|
13782
|
+
const onBackupSuccess = (0, import_react36.useCallback)(() => {
|
|
13783
|
+
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13784
|
+
}, [hasServerVault]);
|
|
13812
13785
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = (0, import_react_query17.useMutation)({
|
|
13813
13786
|
mutationFn: async () => {
|
|
13814
13787
|
const iframeManager = getIframeManager();
|
|
13815
13788
|
if (!iframeManager) {
|
|
13816
13789
|
throw new Error("Iframe manager not initialized");
|
|
13817
13790
|
}
|
|
13818
|
-
const jwt =
|
|
13791
|
+
const jwt = import_auth21.jwtTokenManager.getTokens();
|
|
13819
13792
|
if (!usePasskey && !restorePassword) {
|
|
13820
13793
|
throw new Error("Please provide a password for the backup");
|
|
13821
13794
|
}
|
|
13822
13795
|
const password = !usePasskey ? restorePassword : void 0;
|
|
13823
|
-
|
|
13824
|
-
console.log("[BACKUP STATUS] is new user:", jwt.isNewUser, !hasServerVault, "usePasskey:", usePasskey);
|
|
13796
|
+
console.log("[BACKUP STATUS] is new user:", jwt.isNewUser);
|
|
13825
13797
|
return {
|
|
13826
13798
|
response: await iframeManager.createBackup(passportUserId, { method: "server", password }, jwt.accessToken),
|
|
13827
|
-
|
|
13799
|
+
isNewUser: jwt.isNewUser
|
|
13828
13800
|
};
|
|
13829
13801
|
},
|
|
13830
|
-
onSuccess: async ({ response,
|
|
13802
|
+
onSuccess: async ({ response, isNewUser }) => {
|
|
13803
|
+
const { setError, setSuccess } = useRestoreStore.getState();
|
|
13831
13804
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13832
13805
|
if (response.success) {
|
|
13833
13806
|
setError("");
|
|
@@ -13835,7 +13808,11 @@ function useCreateBackup() {
|
|
|
13835
13808
|
if (typeof window !== "undefined") {
|
|
13836
13809
|
window.dispatchEvent(
|
|
13837
13810
|
new CustomEvent("lumia-passport-backup-status-changed", {
|
|
13838
|
-
detail: {
|
|
13811
|
+
detail: {
|
|
13812
|
+
method: "server",
|
|
13813
|
+
success: true,
|
|
13814
|
+
navigateToNicknameMenu: !!isNewUser
|
|
13815
|
+
}
|
|
13839
13816
|
})
|
|
13840
13817
|
);
|
|
13841
13818
|
}
|
|
@@ -13843,9 +13820,10 @@ function useCreateBackup() {
|
|
|
13843
13820
|
} else {
|
|
13844
13821
|
setError(response.error || "Server backup failed");
|
|
13845
13822
|
}
|
|
13846
|
-
setIsDialogForced(false);
|
|
13823
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
13847
13824
|
},
|
|
13848
13825
|
onError: async (error) => {
|
|
13826
|
+
const { setError, setSuccess } = useRestoreStore.getState();
|
|
13849
13827
|
setSuccess("");
|
|
13850
13828
|
if (error?.name === "NotAllowedError" || error?.message?.includes("timed out or was not allowed")) {
|
|
13851
13829
|
setError("Passkey selection was cancelled. Please try again or create a new passkey.");
|
|
@@ -13874,7 +13852,7 @@ function useCreateBackup() {
|
|
|
13874
13852
|
},
|
|
13875
13853
|
onSuccess: async () => {
|
|
13876
13854
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13877
|
-
setSuccess("Backup file downloaded successfully");
|
|
13855
|
+
useRestoreStore.getState().setSuccess("Backup file downloaded successfully");
|
|
13878
13856
|
if (typeof window !== "undefined") {
|
|
13879
13857
|
window.dispatchEvent(
|
|
13880
13858
|
new CustomEvent("lumia-passport-backup-status-changed", {
|
|
@@ -13885,13 +13863,13 @@ function useCreateBackup() {
|
|
|
13885
13863
|
onBackupSuccess();
|
|
13886
13864
|
},
|
|
13887
13865
|
onError: async (error) => {
|
|
13888
|
-
setError(error?.message || "Backup creation failed");
|
|
13866
|
+
useRestoreStore.getState().setError(error?.message || "Backup creation failed");
|
|
13889
13867
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13890
13868
|
}
|
|
13891
13869
|
});
|
|
13892
13870
|
const { mutate: createPasskey, isPending: isPasskeyCreating } = (0, import_react_query17.useMutation)({
|
|
13893
13871
|
mutationFn: async () => {
|
|
13894
|
-
setIsCreatingPasskey(true);
|
|
13872
|
+
useRestoreStore.getState().setIsCreatingPasskey(true);
|
|
13895
13873
|
const { linkPasskeyWithWebAuthn: linkPasskeyWithWebAuthn2 } = await Promise.resolve().then(() => (init_passkey2(), passkey_exports2));
|
|
13896
13874
|
const { createPasskeyHelpers: createPasskeyHelpers2 } = await Promise.resolve().then(() => (init_passkey(), passkey_exports));
|
|
13897
13875
|
const { credentialId, rawId } = await linkPasskeyWithWebAuthn2();
|
|
@@ -13901,11 +13879,13 @@ function useCreateBackup() {
|
|
|
13901
13879
|
return { credentialId, rawId };
|
|
13902
13880
|
},
|
|
13903
13881
|
onSuccess: async () => {
|
|
13882
|
+
const { setError, setSuccess, setIsCreatingPasskey } = useRestoreStore.getState();
|
|
13904
13883
|
setIsCreatingPasskey(false);
|
|
13905
13884
|
setError(null);
|
|
13906
13885
|
setSuccess("Passkey created successfully. You can now create a backup.");
|
|
13907
13886
|
},
|
|
13908
13887
|
onError: async (error) => {
|
|
13888
|
+
const { setError, setIsCreatingPasskey } = useRestoreStore.getState();
|
|
13909
13889
|
setIsCreatingPasskey(false);
|
|
13910
13890
|
if (error.name === "NotAllowedError") {
|
|
13911
13891
|
setError("Passkey creation cancelled. Please try again.");
|
|
@@ -13938,7 +13918,7 @@ function useCreateBackup() {
|
|
|
13938
13918
|
},
|
|
13939
13919
|
onSuccess: async ({ provider, uploadResult }) => {
|
|
13940
13920
|
console.log("[KeyshareBackup] Cloud backup upload result:", uploadResult);
|
|
13941
|
-
setSuccess(`Successfully created cloud backup on ${provider.name}`);
|
|
13921
|
+
useRestoreStore.getState().setSuccess(`Successfully created cloud backup on ${provider.name}`);
|
|
13942
13922
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13943
13923
|
if (typeof window !== "undefined") {
|
|
13944
13924
|
window.dispatchEvent(
|
|
@@ -13950,7 +13930,7 @@ function useCreateBackup() {
|
|
|
13950
13930
|
onBackupSuccess();
|
|
13951
13931
|
},
|
|
13952
13932
|
onError: async (error) => {
|
|
13953
|
-
setError(error?.message || "Backup creation failed");
|
|
13933
|
+
useRestoreStore.getState().setError(error?.message || "Backup creation failed");
|
|
13954
13934
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13955
13935
|
}
|
|
13956
13936
|
});
|
|
@@ -13971,6 +13951,7 @@ var init_useCreateBackup = __esm({
|
|
|
13971
13951
|
init_SessionContext();
|
|
13972
13952
|
import_react_query17 = require("@tanstack/react-query");
|
|
13973
13953
|
import_react36 = require("react");
|
|
13954
|
+
init_auth();
|
|
13974
13955
|
init_useLayoutStore();
|
|
13975
13956
|
init_iframe_manager();
|
|
13976
13957
|
init_constants4();
|
|
@@ -15080,23 +15061,14 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15080
15061
|
const qc = (0, import_react_query21.useQueryClient)();
|
|
15081
15062
|
const { callbacksRef } = useProviderConfig();
|
|
15082
15063
|
const { t } = useT();
|
|
15083
|
-
const
|
|
15064
|
+
const address = useSession((st) => st.address);
|
|
15084
15065
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
15085
|
-
const
|
|
15086
|
-
const
|
|
15087
|
-
const
|
|
15088
|
-
method: currentRestoreMethod,
|
|
15089
|
-
error,
|
|
15090
|
-
success,
|
|
15091
|
-
setError,
|
|
15092
|
-
setShowPassword,
|
|
15093
|
-
setUsePasskey,
|
|
15094
|
-
setRestoreFile,
|
|
15095
|
-
setRestorePassword,
|
|
15096
|
-
setSuccess,
|
|
15097
|
-
setMethod
|
|
15098
|
-
} = useRestoreStore();
|
|
15066
|
+
const error = useRestoreStore((st) => st.error);
|
|
15067
|
+
const success = useRestoreStore((st) => st.success);
|
|
15068
|
+
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
15099
15069
|
(0, import_react43.useEffect)(() => {
|
|
15070
|
+
const { setIsDialogForced } = useLayoutStore.getState();
|
|
15071
|
+
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15100
15072
|
setIsDialogForced(true);
|
|
15101
15073
|
return () => {
|
|
15102
15074
|
setRestorePassword("");
|
|
@@ -15123,14 +15095,17 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15123
15095
|
});
|
|
15124
15096
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15125
15097
|
(0, import_react43.useEffect)(() => {
|
|
15126
|
-
if (!!hasServerBackup) setMethod("server");
|
|
15098
|
+
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
15127
15099
|
}, [hasServerBackup]);
|
|
15128
15100
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query21.useMutation)({
|
|
15129
15101
|
mutationFn: async () => {
|
|
15102
|
+
const { setStatus, setIsLoading } = useSession.getState();
|
|
15103
|
+
const { setError, setMethod } = useRestoreStore.getState();
|
|
15130
15104
|
setError(null);
|
|
15131
15105
|
setMethod(null);
|
|
15132
15106
|
setStatus("disconnecting");
|
|
15133
15107
|
setIsLoading(true);
|
|
15108
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
15134
15109
|
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
15135
15110
|
const userId = jwtTokenManager4.getUserId() || null;
|
|
15136
15111
|
const { logout: logout2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
@@ -15139,20 +15114,22 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15139
15114
|
},
|
|
15140
15115
|
onSuccess: async ({ disconnectedUserId }) => {
|
|
15141
15116
|
await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
15117
|
+
const { setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
15142
15118
|
setSession(null);
|
|
15143
15119
|
setAddress(null);
|
|
15144
|
-
setError(null);
|
|
15145
15120
|
setStatus("idle");
|
|
15146
15121
|
setIsLoading(false);
|
|
15147
|
-
|
|
15122
|
+
useRestoreStore.getState().setError(null);
|
|
15123
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
15148
15124
|
callbacksRef.current?.onDisconnect?.({ address: "0x", userId: disconnectedUserId });
|
|
15149
|
-
setTimeout(() => setPage("auth" /* AUTH */), 50);
|
|
15125
|
+
setTimeout(() => useLayoutDataStore.getState().setPage("auth" /* AUTH */), 50);
|
|
15150
15126
|
},
|
|
15151
15127
|
onError: (err) => {
|
|
15152
|
-
|
|
15128
|
+
const { setStatus, setIsLoading } = useSession.getState();
|
|
15153
15129
|
setStatus("idle");
|
|
15154
15130
|
setIsLoading(false);
|
|
15155
|
-
|
|
15131
|
+
useRestoreStore.getState().setError(err.message || "An unknown error occurred during sign out");
|
|
15132
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
15156
15133
|
}
|
|
15157
15134
|
});
|
|
15158
15135
|
const RestoreComponent = currentRestoreMethod ? RESTORE_COMPONENTS[currentRestoreMethod] : null;
|
|
@@ -15186,6 +15163,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15186
15163
|
labels: { checked: t("passport:common.standard"), unchecked: t("passport:common.advanced") },
|
|
15187
15164
|
checked: currentRestoreMethod !== "server",
|
|
15188
15165
|
onChange: () => {
|
|
15166
|
+
const { setError, setRestorePassword, setRestoreFile, setMethod } = useRestoreStore.getState();
|
|
15189
15167
|
if (!!error) setError(null);
|
|
15190
15168
|
if (currentRestoreMethod === "server") {
|
|
15191
15169
|
setRestorePassword("");
|
|
@@ -15215,6 +15193,15 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15215
15193
|
size: "large",
|
|
15216
15194
|
variant: "ghost",
|
|
15217
15195
|
onClick: () => {
|
|
15196
|
+
const {
|
|
15197
|
+
setError,
|
|
15198
|
+
setShowPassword,
|
|
15199
|
+
setUsePasskey,
|
|
15200
|
+
setRestoreFile,
|
|
15201
|
+
setRestorePassword,
|
|
15202
|
+
setSuccess,
|
|
15203
|
+
setMethod
|
|
15204
|
+
} = useRestoreStore.getState();
|
|
15218
15205
|
setError(null);
|
|
15219
15206
|
setShowPassword(false);
|
|
15220
15207
|
setUsePasskey(false);
|
|
@@ -15257,20 +15244,11 @@ function KeyshareBackupMenu() {
|
|
|
15257
15244
|
const { t } = useT();
|
|
15258
15245
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15259
15246
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
15260
|
-
const
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
success,
|
|
15264
|
-
setSelectedCloudProvider,
|
|
15265
|
-
setSuccess,
|
|
15266
|
-
setError,
|
|
15267
|
-
setRestorePassword,
|
|
15268
|
-
setRestoreFile,
|
|
15269
|
-
setShowPassword,
|
|
15270
|
-
setUsePasskey,
|
|
15271
|
-
setMethod
|
|
15272
|
-
} = useRestoreStore();
|
|
15247
|
+
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15248
|
+
const error = useRestoreStore((st) => st.error);
|
|
15249
|
+
const success = useRestoreStore((st) => st.success);
|
|
15273
15250
|
(0, import_react44.useEffect)(() => {
|
|
15251
|
+
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15274
15252
|
return () => {
|
|
15275
15253
|
setSuccess(null);
|
|
15276
15254
|
setError(null);
|
|
@@ -15284,13 +15262,12 @@ function KeyshareBackupMenu() {
|
|
|
15284
15262
|
const { data: serverRecoveryStatus, isLoading: isRecoveryLoading } = (0, import_react_query22.useQuery)({
|
|
15285
15263
|
retry: false,
|
|
15286
15264
|
enabled: !!address,
|
|
15287
|
-
// Prevent query from running with undefined address
|
|
15288
15265
|
queryKey: [CHECK_BACKUP_QUERY_KEY, address],
|
|
15289
15266
|
queryFn: async () => await getShareRecoveryStats()
|
|
15290
15267
|
});
|
|
15291
15268
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15292
15269
|
(0, import_react44.useEffect)(() => {
|
|
15293
|
-
if (!!hasRecoveryData) setMethod("server");
|
|
15270
|
+
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15294
15271
|
}, [hasRecoveryData]);
|
|
15295
15272
|
const {
|
|
15296
15273
|
isPasswordBackupCreating,
|
|
@@ -15323,6 +15300,16 @@ function KeyshareBackupMenu() {
|
|
|
15323
15300
|
size: "icon",
|
|
15324
15301
|
title: "Back",
|
|
15325
15302
|
onClick: () => {
|
|
15303
|
+
const {
|
|
15304
|
+
setSuccess,
|
|
15305
|
+
setError,
|
|
15306
|
+
setRestorePassword,
|
|
15307
|
+
setRestoreFile,
|
|
15308
|
+
setShowPassword,
|
|
15309
|
+
setUsePasskey,
|
|
15310
|
+
setMethod,
|
|
15311
|
+
setSelectedCloudProvider
|
|
15312
|
+
} = useRestoreStore.getState();
|
|
15326
15313
|
setRestorePassword("");
|
|
15327
15314
|
setRestoreFile(null);
|
|
15328
15315
|
setShowPassword(false);
|
|
@@ -15345,6 +15332,7 @@ function KeyshareBackupMenu() {
|
|
|
15345
15332
|
labels: { checked: t("passport:common.standard"), unchecked: t("passport:common.advanced") },
|
|
15346
15333
|
checked: currentBackupMethod !== "server",
|
|
15347
15334
|
onChange: () => {
|
|
15335
|
+
const { setError, setRestorePassword, setRestoreFile, setMethod } = useRestoreStore.getState();
|
|
15348
15336
|
if (!!error) setError(null);
|
|
15349
15337
|
if (currentBackupMethod === "server") {
|
|
15350
15338
|
setRestorePassword("");
|
|
@@ -15377,21 +15365,12 @@ function KeyshareBackupMenu() {
|
|
|
15377
15365
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react35.AlertCircle, { className: "h-4 w-4 flex-shrink-0" }),
|
|
15378
15366
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "block w-full flex-1", children: error })
|
|
15379
15367
|
] }),
|
|
15380
|
-
success && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15381
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15368
|
+
success && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Highlight, { type: "success", className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
15369
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
15382
15370
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react35.CheckCircle2, { className: "h-4 w-4 flex-shrink-0" }),
|
|
15383
15371
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "block w-full flex-1", children: success })
|
|
15384
15372
|
] }),
|
|
15385
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15386
|
-
Button,
|
|
15387
|
-
{
|
|
15388
|
-
variant: "default",
|
|
15389
|
-
size: "large",
|
|
15390
|
-
className: "w-full",
|
|
15391
|
-
onClick: () => setPage("settings" /* SETTINGS */),
|
|
15392
|
-
children: "Done"
|
|
15393
|
-
}
|
|
15394
|
-
)
|
|
15373
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Button, { variant: "default", size: "large", className: "w-full", onClick: () => setPage("settings" /* SETTINGS */), children: t("passport:common.continue") })
|
|
15395
15374
|
] })
|
|
15396
15375
|
] })
|
|
15397
15376
|
}
|
|
@@ -15826,9 +15805,9 @@ var init_LanguagesMenu2 = __esm({
|
|
|
15826
15805
|
|
|
15827
15806
|
// src/internal/auth/providers/common.ts
|
|
15828
15807
|
async function getLinkedProviders() {
|
|
15829
|
-
const hasValidToken = await (0,
|
|
15808
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
15830
15809
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
15831
|
-
const response = await (0,
|
|
15810
|
+
const response = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/providers`, { method: "GET" });
|
|
15832
15811
|
if (!response.ok) {
|
|
15833
15812
|
const errorData = await response.json().catch(() => ({}));
|
|
15834
15813
|
throw new Error(errorData.message || `Failed to fetch providers: ${response.statusText}`);
|
|
@@ -15837,11 +15816,11 @@ async function getLinkedProviders() {
|
|
|
15837
15816
|
return data.providers;
|
|
15838
15817
|
}
|
|
15839
15818
|
async function unlinkProvider(providerType, externalId) {
|
|
15840
|
-
const hasValidToken = await (0,
|
|
15819
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
15841
15820
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
15842
15821
|
let url = `${getTssUrl3()}/api/auth/unlink/${providerType}`;
|
|
15843
15822
|
if (externalId) url += `?externalId=${encodeURIComponent(externalId)}`;
|
|
15844
|
-
const response = await (0,
|
|
15823
|
+
const response = await (0, import_auth21.authenticatedFetch)(url, { method: "DELETE" });
|
|
15845
15824
|
if (!response.ok) {
|
|
15846
15825
|
const errorData = await response.json().catch(() => ({}));
|
|
15847
15826
|
throw new Error(errorData.message || `Failed to unlink provider: ${response.statusText}`);
|
|
@@ -15849,12 +15828,12 @@ async function unlinkProvider(providerType, externalId) {
|
|
|
15849
15828
|
try {
|
|
15850
15829
|
const data = await response.json();
|
|
15851
15830
|
if (data?.accessToken && data?.refreshToken && data?.expiresIn) {
|
|
15852
|
-
|
|
15831
|
+
import_auth21.jwtTokenManager.setTokens({
|
|
15853
15832
|
accessToken: data.accessToken,
|
|
15854
15833
|
refreshToken: data.refreshToken,
|
|
15855
|
-
userId:
|
|
15834
|
+
userId: import_auth21.jwtTokenManager.getUserId() || "",
|
|
15856
15835
|
expiresIn: data.expiresIn,
|
|
15857
|
-
hasKeyshare:
|
|
15836
|
+
hasKeyshare: import_auth21.jwtTokenManager.getHasKeyshare() ?? false
|
|
15858
15837
|
});
|
|
15859
15838
|
}
|
|
15860
15839
|
} catch {
|
|
@@ -15957,7 +15936,7 @@ function useLinkedProfiles() {
|
|
|
15957
15936
|
});
|
|
15958
15937
|
let avatar2 = null;
|
|
15959
15938
|
try {
|
|
15960
|
-
avatar2 =
|
|
15939
|
+
avatar2 = import_auth21.jwtTokenManager.getAvatar() || null;
|
|
15961
15940
|
} catch {
|
|
15962
15941
|
avatar2 = null;
|
|
15963
15942
|
}
|
|
@@ -16122,9 +16101,9 @@ var init_EmailForm = __esm({
|
|
|
16122
16101
|
|
|
16123
16102
|
// src/internal/auth/providers/email.ts
|
|
16124
16103
|
async function sendEmailLinkCode(email) {
|
|
16125
|
-
const hasValidToken = await (0,
|
|
16104
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
16126
16105
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16127
|
-
const response = await (0,
|
|
16106
|
+
const response = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/email/send-code`, {
|
|
16128
16107
|
method: "POST",
|
|
16129
16108
|
body: JSON.stringify({ email })
|
|
16130
16109
|
});
|
|
@@ -16134,9 +16113,9 @@ async function sendEmailLinkCode(email) {
|
|
|
16134
16113
|
}
|
|
16135
16114
|
}
|
|
16136
16115
|
async function verifyEmailLinkCode(email, code) {
|
|
16137
|
-
const hasValidToken = await (0,
|
|
16116
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
16138
16117
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16139
|
-
const response = await (0,
|
|
16118
|
+
const response = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/email/verify-code`, {
|
|
16140
16119
|
method: "POST",
|
|
16141
16120
|
credentials: "include",
|
|
16142
16121
|
body: JSON.stringify({ email, code })
|
|
@@ -16422,7 +16401,7 @@ var init_AddProvider = __esm({
|
|
|
16422
16401
|
|
|
16423
16402
|
// src/internal/components/ManageWalletMenu/EmailNotConnectedWarning.tsx
|
|
16424
16403
|
function EmailNotConnectedWarning() {
|
|
16425
|
-
const providers =
|
|
16404
|
+
const providers = import_auth21.jwtTokenManager.getProviders();
|
|
16426
16405
|
const hasEmail = providers.includes("email");
|
|
16427
16406
|
const { t } = useT();
|
|
16428
16407
|
const config = useProviderConfig().config;
|
|
@@ -16489,11 +16468,11 @@ function useLinkSocial() {
|
|
|
16489
16468
|
mode: "link"
|
|
16490
16469
|
};
|
|
16491
16470
|
try {
|
|
16492
|
-
await (0,
|
|
16471
|
+
await (0, import_auth21.ensureValidToken)();
|
|
16493
16472
|
} catch (tokenError) {
|
|
16494
16473
|
console.warn("[ManageWallet] ensureValidToken failed before linking", tokenError);
|
|
16495
16474
|
}
|
|
16496
|
-
const accessToken =
|
|
16475
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
16497
16476
|
if (accessToken) {
|
|
16498
16477
|
authConfig.token = accessToken;
|
|
16499
16478
|
}
|
|
@@ -16560,7 +16539,7 @@ var init_useLinkSocial = __esm({
|
|
|
16560
16539
|
|
|
16561
16540
|
// src/internal/auth/providers/telegram.ts
|
|
16562
16541
|
async function linkTelegram(telegramData) {
|
|
16563
|
-
const hasValidToken = await (0,
|
|
16542
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
16564
16543
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16565
16544
|
const formattedData = {
|
|
16566
16545
|
id: telegramData.id,
|
|
@@ -16571,7 +16550,7 @@ async function linkTelegram(telegramData) {
|
|
|
16571
16550
|
if (telegramData.last_name) formattedData.last_name = telegramData.last_name;
|
|
16572
16551
|
if (telegramData.username) formattedData.username = telegramData.username;
|
|
16573
16552
|
if (telegramData.photo_url) formattedData.photo_url = telegramData.photo_url;
|
|
16574
|
-
const response = await (0,
|
|
16553
|
+
const response = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/telegram`, {
|
|
16575
16554
|
method: "POST",
|
|
16576
16555
|
body: JSON.stringify(formattedData)
|
|
16577
16556
|
});
|
|
@@ -17591,7 +17570,7 @@ var init_NicknameMenu2 = __esm({
|
|
|
17591
17570
|
function getCachedPublicClient(chainId) {
|
|
17592
17571
|
const cachedClient = publicClientByChainId.get(chainId);
|
|
17593
17572
|
if (cachedClient) return cachedClient;
|
|
17594
|
-
const publicClient = (0,
|
|
17573
|
+
const publicClient = (0, import_read14.createPublicClientForChain)(chainId);
|
|
17595
17574
|
publicClientByChainId.set(chainId, publicClient);
|
|
17596
17575
|
return publicClient;
|
|
17597
17576
|
}
|
|
@@ -17603,7 +17582,7 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17603
17582
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17604
17583
|
const chainConfig = (0, import_react56.useMemo)(() => {
|
|
17605
17584
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
17606
|
-
return (0,
|
|
17585
|
+
return (0, import_read14.getChainConfig)(chainId);
|
|
17607
17586
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17608
17587
|
const publicClient = (0, import_react56.useMemo)(() => {
|
|
17609
17588
|
if (shouldUseActiveClient) return activePublicClient;
|
|
@@ -17622,11 +17601,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17622
17601
|
resolvedChainId
|
|
17623
17602
|
};
|
|
17624
17603
|
}
|
|
17625
|
-
var
|
|
17604
|
+
var import_read14, import_react56, publicClientByChainId;
|
|
17626
17605
|
var init_useResolvedPublicClient = __esm({
|
|
17627
17606
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17628
17607
|
init_SessionContext();
|
|
17629
|
-
|
|
17608
|
+
import_read14 = require("@embarkai/core/read");
|
|
17630
17609
|
import_react56 = require("react");
|
|
17631
17610
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17632
17611
|
}
|
|
@@ -19082,8 +19061,8 @@ function SecurityMenu() {
|
|
|
19082
19061
|
const { t } = useT();
|
|
19083
19062
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
19084
19063
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
19085
|
-
const userId =
|
|
19086
|
-
const serverHasKeyshare =
|
|
19064
|
+
const userId = import_auth21.jwtTokenManager.getUserId();
|
|
19065
|
+
const serverHasKeyshare = import_auth21.jwtTokenManager.getHasKeyshare() ?? false;
|
|
19087
19066
|
const [appToUntrust, untrustApp] = (0, import_react62.useState)(null);
|
|
19088
19067
|
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
19089
19068
|
const localInfo = recoveryData?.keyshareInfo || {};
|
|
@@ -19204,9 +19183,9 @@ async function walletLogin(walletData) {
|
|
|
19204
19183
|
return response.json();
|
|
19205
19184
|
}
|
|
19206
19185
|
async function linkWallet(walletData) {
|
|
19207
|
-
const hasValidToken = await (0,
|
|
19186
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
19208
19187
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
19209
|
-
const response = await (0,
|
|
19188
|
+
const response = await (0, import_auth21.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/wallet`, {
|
|
19210
19189
|
method: "POST",
|
|
19211
19190
|
body: JSON.stringify(walletData)
|
|
19212
19191
|
});
|
|
@@ -19216,9 +19195,9 @@ async function linkWallet(walletData) {
|
|
|
19216
19195
|
}
|
|
19217
19196
|
}
|
|
19218
19197
|
async function unlinkWallet(address) {
|
|
19219
|
-
const hasValidToken = await (0,
|
|
19198
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
19220
19199
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
19221
|
-
const response = await (0,
|
|
19200
|
+
const response = await (0, import_auth21.authenticatedFetch)(
|
|
19222
19201
|
`${getTssUrl3()}/api/auth/unlink/wallet?address=${encodeURIComponent(address)}`,
|
|
19223
19202
|
{
|
|
19224
19203
|
method: "DELETE"
|
|
@@ -19312,23 +19291,23 @@ var init_useFlowSelector = __esm({
|
|
|
19312
19291
|
});
|
|
19313
19292
|
|
|
19314
19293
|
// src/internal/components/SendMenu/hyperbridge/lib/chains.ts
|
|
19315
|
-
var
|
|
19294
|
+
var import_read15, import_chains, CHAINS_UI_META;
|
|
19316
19295
|
var init_chains = __esm({
|
|
19317
19296
|
"src/internal/components/SendMenu/hyperbridge/lib/chains.ts"() {
|
|
19318
19297
|
init_EthereumIcon();
|
|
19319
19298
|
init_LumiaIcon2();
|
|
19320
19299
|
init_BscIcon();
|
|
19321
|
-
|
|
19300
|
+
import_read15 = require("@embarkai/core/read");
|
|
19322
19301
|
import_chains = require("wagmi/chains");
|
|
19323
19302
|
CHAINS_UI_META = {
|
|
19324
19303
|
lumiaprism: {
|
|
19325
|
-
chainID:
|
|
19326
|
-
chainLabel:
|
|
19304
|
+
chainID: import_read15.lumiaMainnetChain.id,
|
|
19305
|
+
chainLabel: import_read15.lumiaMainnetChain.name,
|
|
19327
19306
|
chainName: "lumiaprism",
|
|
19328
19307
|
// exact hyperlane registry chain name
|
|
19329
19308
|
Icon: LumiaIcon2,
|
|
19330
|
-
explorerUrl:
|
|
19331
|
-
chain:
|
|
19309
|
+
explorerUrl: import_read15.lumiaMainnetChain.blockExplorers.default.url,
|
|
19310
|
+
chain: import_read15.lumiaMainnetChain
|
|
19332
19311
|
},
|
|
19333
19312
|
bsc: {
|
|
19334
19313
|
chainID: import_chains.bsc.id,
|
|
@@ -19737,7 +19716,7 @@ var init_useAvailableSenders = __esm({
|
|
|
19737
19716
|
|
|
19738
19717
|
// src/internal/components/SendMenu/hyperbridge/api.ts
|
|
19739
19718
|
function iframe3() {
|
|
19740
|
-
const accessToken =
|
|
19719
|
+
const accessToken = import_auth21.jwtTokenManager.getAccessToken();
|
|
19741
19720
|
if (!accessToken) {
|
|
19742
19721
|
throw new Error("Access token is not available");
|
|
19743
19722
|
}
|
|
@@ -19802,7 +19781,7 @@ var init_api3 = __esm({
|
|
|
19802
19781
|
// src/clients/bundler/getUserOperationByHash.ts
|
|
19803
19782
|
async function getUserOperationByHash(userOpHash, chainId) {
|
|
19804
19783
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
19805
|
-
const chainConfig = (0,
|
|
19784
|
+
const chainConfig = (0, import_read16.getChainConfig)(targetChainId);
|
|
19806
19785
|
if (!chainConfig) {
|
|
19807
19786
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
19808
19787
|
}
|
|
@@ -19830,19 +19809,19 @@ async function getUserOperationByHash(userOpHash, chainId) {
|
|
|
19830
19809
|
return null;
|
|
19831
19810
|
}
|
|
19832
19811
|
}
|
|
19833
|
-
var import_core3,
|
|
19812
|
+
var import_core3, import_read16;
|
|
19834
19813
|
var init_getUserOperationByHash = __esm({
|
|
19835
19814
|
"src/clients/bundler/getUserOperationByHash.ts"() {
|
|
19836
19815
|
init_SessionContext();
|
|
19837
19816
|
import_core3 = require("@embarkai/core");
|
|
19838
|
-
|
|
19817
|
+
import_read16 = require("@embarkai/core/read");
|
|
19839
19818
|
}
|
|
19840
19819
|
});
|
|
19841
19820
|
|
|
19842
19821
|
// src/clients/bundler/getUserOperationReceipt.ts
|
|
19843
19822
|
async function getUserOperationReceipt(userOpHash, chainId) {
|
|
19844
19823
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
19845
|
-
const chainConfig = (0,
|
|
19824
|
+
const chainConfig = (0, import_read17.getChainConfig)(targetChainId);
|
|
19846
19825
|
if (!chainConfig) {
|
|
19847
19826
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
19848
19827
|
}
|
|
@@ -19876,12 +19855,12 @@ async function getUserOperationReceipt(userOpHash, chainId) {
|
|
|
19876
19855
|
return null;
|
|
19877
19856
|
}
|
|
19878
19857
|
}
|
|
19879
|
-
var import_core4,
|
|
19858
|
+
var import_core4, import_read17;
|
|
19880
19859
|
var init_getUserOperationReceipt = __esm({
|
|
19881
19860
|
"src/clients/bundler/getUserOperationReceipt.ts"() {
|
|
19882
19861
|
init_SessionContext();
|
|
19883
19862
|
import_core4 = require("@embarkai/core");
|
|
19884
|
-
|
|
19863
|
+
import_read17 = require("@embarkai/core/read");
|
|
19885
19864
|
}
|
|
19886
19865
|
});
|
|
19887
19866
|
|
|
@@ -20049,7 +20028,7 @@ function isOririnChainEmbarkSupported(originChain) {
|
|
|
20049
20028
|
var import_viem12;
|
|
20050
20029
|
var init_utils8 = __esm({
|
|
20051
20030
|
"src/internal/components/SendMenu/hyperbridge/utils.ts"() {
|
|
20052
|
-
|
|
20031
|
+
init_networks4();
|
|
20053
20032
|
import_viem12 = require("viem");
|
|
20054
20033
|
init_chains();
|
|
20055
20034
|
}
|
|
@@ -20273,6 +20252,7 @@ function useBridge() {
|
|
|
20273
20252
|
},
|
|
20274
20253
|
onSuccess: (operationHashes) => {
|
|
20275
20254
|
const { setBridgeStep, setBridgeTxStatus } = useBridgeStore.getState();
|
|
20255
|
+
qc.invalidateQueries({ queryKey: [HYPERLANE_HISTORY_QUERY_KEY] });
|
|
20276
20256
|
useOperationHashesStore.getState().setOperationHashes(operationHashes);
|
|
20277
20257
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
20278
20258
|
useFlowSelectorStore.getState().setIsUiLocked(false);
|
|
@@ -20285,7 +20265,7 @@ function useBridge() {
|
|
|
20285
20265
|
if (hyperlaneDbTx?.id) {
|
|
20286
20266
|
patchInitiatedBridgeTxStatus({ txId: hyperlaneDbTx.id, txStatus: "REJECTED" }).then(({ ok }) => {
|
|
20287
20267
|
console.log("[HYPERLANE SDK] initiated tx patched as REJECTED: ", hyperlaneDbTx.id, "ok: ", ok);
|
|
20288
|
-
if (ok) qc.invalidateQueries({ queryKey: [HYPERLANE_HISTORY_QUERY_KEY
|
|
20268
|
+
if (ok) qc.invalidateQueries({ queryKey: [HYPERLANE_HISTORY_QUERY_KEY] });
|
|
20289
20269
|
});
|
|
20290
20270
|
}
|
|
20291
20271
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
@@ -21579,6 +21559,7 @@ function BridgeHistorySwitch(props) {
|
|
|
21579
21559
|
onChange: () => {
|
|
21580
21560
|
const { bridgeStep: bridgeStep2, setBridgeStep } = useBridgeStore.getState();
|
|
21581
21561
|
if (bridgeStep2 !== "tx-history") lastBridgeStepRef.current = bridgeStep2;
|
|
21562
|
+
useFlowSelectorStore.getState().setError(null);
|
|
21582
21563
|
setBridgeStep(bridgeStep2 === "tx-history" ? lastBridgeStepRef.current || "select" : "tx-history");
|
|
21583
21564
|
}
|
|
21584
21565
|
}
|
|
@@ -23298,27 +23279,27 @@ function getHistoryUrls(params) {
|
|
|
23298
23279
|
}
|
|
23299
23280
|
return getBlockscoutHistoryUrls(params);
|
|
23300
23281
|
}
|
|
23301
|
-
var
|
|
23282
|
+
var import_read18, ETHERSCAN_V2_API_URL, BLOCKSCOUT_API_URLS, CHAIN_SPECIFIC_API_URLS, ETHERSCAN_CHAINS, UNSUPPORTED_HISTORY_CHAINS, TX_HISTORY_URLS;
|
|
23302
23283
|
var init_txUrls = __esm({
|
|
23303
23284
|
"src/internal/components/TransactionsMenu/txUrls.ts"() {
|
|
23304
|
-
|
|
23285
|
+
import_read18 = require("@embarkai/core/read");
|
|
23305
23286
|
init_base();
|
|
23306
23287
|
ETHERSCAN_V2_API_URL = "https://api.etherscan.io/v2/api";
|
|
23307
23288
|
BLOCKSCOUT_API_URLS = {
|
|
23308
|
-
[
|
|
23309
|
-
[
|
|
23289
|
+
[import_read18.ARBITRUM_SEPOLIA_CHAIN_ID]: "https://arbitrum-sepolia.blockscout.com/api",
|
|
23290
|
+
[import_read18.BASE_SEPOLIA_CHAIN_ID]: "https://base-sepolia.blockscout.com/api"
|
|
23310
23291
|
};
|
|
23311
23292
|
CHAIN_SPECIFIC_API_URLS = {};
|
|
23312
23293
|
ETHERSCAN_CHAINS = /* @__PURE__ */ new Set([
|
|
23313
|
-
|
|
23314
|
-
|
|
23315
|
-
|
|
23294
|
+
import_read18.SEPOLIA_CHAIN_ID,
|
|
23295
|
+
import_read18.ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
23296
|
+
import_read18.BASE_SEPOLIA_CHAIN_ID
|
|
23316
23297
|
]);
|
|
23317
23298
|
UNSUPPORTED_HISTORY_CHAINS = /* @__PURE__ */ new Set([
|
|
23318
|
-
|
|
23299
|
+
import_read18.BSC_TESTNET_CHAIN_ID
|
|
23319
23300
|
]);
|
|
23320
23301
|
TX_HISTORY_URLS = {
|
|
23321
|
-
[
|
|
23302
|
+
[import_read18.LUMIA_TESTNET_CHAIN_ID]: (p) => {
|
|
23322
23303
|
const result = getBlockscoutHistoryUrls(p);
|
|
23323
23304
|
return {
|
|
23324
23305
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -23326,7 +23307,7 @@ var init_txUrls = __esm({
|
|
|
23326
23307
|
tokenTransfersUrl: result.tokenTransfersUrl
|
|
23327
23308
|
};
|
|
23328
23309
|
},
|
|
23329
|
-
[
|
|
23310
|
+
[import_read18.LUMIA_MAINNET_CHAIN_ID]: (p) => {
|
|
23330
23311
|
const result = getBlockscoutHistoryUrls(p);
|
|
23331
23312
|
return {
|
|
23332
23313
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -24441,7 +24422,7 @@ var init_usePageMapper = __esm({
|
|
|
24441
24422
|
function useSettingsNotifications() {
|
|
24442
24423
|
const address = useSession((st) => st.address);
|
|
24443
24424
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
24444
|
-
const providers =
|
|
24425
|
+
const providers = import_auth21.jwtTokenManager.getProviders();
|
|
24445
24426
|
const hasEmail = providers.includes("email");
|
|
24446
24427
|
const { data: userProfile = null } = (0, import_react_query51.useQuery)({
|
|
24447
24428
|
retry: false,
|
|
@@ -24491,7 +24472,7 @@ var init_package = __esm({
|
|
|
24491
24472
|
"package.json"() {
|
|
24492
24473
|
package_default = {
|
|
24493
24474
|
name: "@embarkai/ui-kit",
|
|
24494
|
-
version: "0.4.
|
|
24475
|
+
version: "0.4.47",
|
|
24495
24476
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24496
24477
|
type: "module",
|
|
24497
24478
|
main: "./dist/index.cjs",
|
|
@@ -24592,25 +24573,39 @@ var init_package = __esm({
|
|
|
24592
24573
|
function Footer() {
|
|
24593
24574
|
const qc = (0, import_react_query52.useQueryClient)();
|
|
24594
24575
|
const { callbacksRef } = useProviderConfig();
|
|
24595
|
-
const { address, setSession, setAddress, setStatus, setError, setIsLoading } = useSession();
|
|
24596
|
-
const chainConfig = useSession((st) => st.chainConfig);
|
|
24597
24576
|
const { t } = useT();
|
|
24598
|
-
const
|
|
24599
|
-
const
|
|
24577
|
+
const address = useSession((st) => st.address);
|
|
24578
|
+
const chainConfig = useSession((st) => st.chainConfig);
|
|
24579
|
+
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
24580
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi6.useDisconnect)({
|
|
24581
|
+
mutation: {
|
|
24582
|
+
onSuccess: () => {
|
|
24583
|
+
useExternalWalletStore.getState().clearExternalWallet();
|
|
24584
|
+
useExternalWalletStore.getState().setExternalChainId(null);
|
|
24585
|
+
console.log("[ExternalWalletStore] Disconnected from external wallet");
|
|
24586
|
+
},
|
|
24587
|
+
onError: (err) => {
|
|
24588
|
+
console.error("[ExternalWalletStore] Error disconnecting from external wallet:", err);
|
|
24589
|
+
}
|
|
24590
|
+
}
|
|
24591
|
+
});
|
|
24600
24592
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query52.useMutation)({
|
|
24601
24593
|
mutationFn: async (disconnectAddress) => {
|
|
24602
24594
|
if (!disconnectAddress) throw new Error("No address to disconnect");
|
|
24603
|
-
|
|
24595
|
+
const { setError, setStatus, setIsLoading } = useSession.getState();
|
|
24596
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
24604
24597
|
setError(null);
|
|
24605
24598
|
setStatus("disconnecting");
|
|
24606
24599
|
setIsLoading(true);
|
|
24607
|
-
const userId =
|
|
24600
|
+
const userId = import_auth21.jwtTokenManager.getUserId() || null;
|
|
24608
24601
|
const { logout: logout2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
24609
24602
|
await logout2();
|
|
24610
24603
|
return { disconnectedUserId: userId, disconnectAddress };
|
|
24611
24604
|
},
|
|
24612
24605
|
onSuccess: async ({ disconnectAddress, disconnectedUserId }) => {
|
|
24613
24606
|
await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
24607
|
+
if (!!directWalletAddress) wagmiDisconnect();
|
|
24608
|
+
const { setError, setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
24614
24609
|
setSession(null);
|
|
24615
24610
|
setAddress(null);
|
|
24616
24611
|
setError(null);
|
|
@@ -24618,15 +24613,16 @@ function Footer() {
|
|
|
24618
24613
|
setIsLoading(false);
|
|
24619
24614
|
callbacksRef.current?.onDisconnect?.({ address: disconnectAddress, userId: disconnectedUserId });
|
|
24620
24615
|
setTimeout(() => {
|
|
24621
|
-
setPage("auth" /* AUTH */);
|
|
24622
|
-
setIsDialogForced(false);
|
|
24616
|
+
useLayoutDataStore.getState().setPage("auth" /* AUTH */);
|
|
24617
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
24623
24618
|
}, 200);
|
|
24624
24619
|
},
|
|
24625
24620
|
onError: (err) => {
|
|
24621
|
+
const { setError, setStatus, setIsLoading } = useSession.getState();
|
|
24626
24622
|
setError(err.message || "An unknown error occurred during sign out");
|
|
24627
24623
|
setStatus("idle");
|
|
24628
24624
|
setIsLoading(false);
|
|
24629
|
-
setIsDialogForced(false);
|
|
24625
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
24630
24626
|
}
|
|
24631
24627
|
});
|
|
24632
24628
|
const ChainIcon = NETWORK_OPTIONS.find((net) => net.chainId === chainConfig.id)?.Icon || (() => /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className: "flex-none w-4 h-4 rounded-full flex items-center justify-center bg-[var(--ui-kit-primary)]", children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "text-[var(--ui-kit-fg-inverted)] text-xs font-bold", children: chainConfig.name.charAt(0) }) }));
|
|
@@ -24679,21 +24675,23 @@ function Footer() {
|
|
|
24679
24675
|
}
|
|
24680
24676
|
);
|
|
24681
24677
|
}
|
|
24682
|
-
var import_react_query52, import_lucide_react76, import_jsx_runtime116;
|
|
24678
|
+
var import_react_query52, import_lucide_react76, import_wagmi6, import_jsx_runtime116;
|
|
24683
24679
|
var init_Footer = __esm({
|
|
24684
24680
|
"src/internal/components/Footer/Footer.tsx"() {
|
|
24685
24681
|
init_package();
|
|
24686
|
-
|
|
24682
|
+
init_networks4();
|
|
24687
24683
|
init_ProviderContext();
|
|
24688
24684
|
init_SessionContext();
|
|
24689
24685
|
init_i18n();
|
|
24690
24686
|
import_react_query52 = require("@tanstack/react-query");
|
|
24691
24687
|
import_lucide_react76 = require("lucide-react");
|
|
24688
|
+
import_wagmi6 = require("wagmi");
|
|
24692
24689
|
init_auth();
|
|
24693
24690
|
init_base();
|
|
24694
24691
|
init_useLayoutDataStore();
|
|
24695
24692
|
init_useLayoutStore();
|
|
24696
24693
|
init_utils2();
|
|
24694
|
+
init_useExternalWalletStore();
|
|
24697
24695
|
init_constants4();
|
|
24698
24696
|
init_button();
|
|
24699
24697
|
import_jsx_runtime116 = require("react/jsx-runtime");
|
|
@@ -24746,8 +24744,8 @@ function Header() {
|
|
|
24746
24744
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24747
24745
|
queryFn: getUserProfile
|
|
24748
24746
|
});
|
|
24749
|
-
const avatar = profile?.avatar ||
|
|
24750
|
-
const displayName = profile?.nicknameDisplay || profile?.displayName ||
|
|
24747
|
+
const avatar = profile?.avatar || import_auth21.jwtTokenManager.getAvatar();
|
|
24748
|
+
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth21.jwtTokenManager.getDisplayName();
|
|
24751
24749
|
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) }) }));
|
|
24752
24750
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
24753
24751
|
"div",
|
|
@@ -24826,7 +24824,7 @@ var import_react_query53, import_lucide_react77, import_react85, import_jsx_runt
|
|
|
24826
24824
|
var init_Header = __esm({
|
|
24827
24825
|
"src/internal/components/Header/Header.tsx"() {
|
|
24828
24826
|
init_LumiaIcon3();
|
|
24829
|
-
|
|
24827
|
+
init_networks4();
|
|
24830
24828
|
init_ProviderContext();
|
|
24831
24829
|
init_SessionContext();
|
|
24832
24830
|
init_useT();
|
|
@@ -25166,10 +25164,10 @@ function WalletConnectHandler() {
|
|
|
25166
25164
|
const qc = (0, import_react_query54.useQueryClient)();
|
|
25167
25165
|
const { callbacksRef } = useProviderConfig();
|
|
25168
25166
|
const passportWalletAddress = useSession((st) => st.address);
|
|
25169
|
-
const { address: walletAddress, isConnected, chain, connector } = (0,
|
|
25167
|
+
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi7.useAccount)();
|
|
25170
25168
|
const { openConnectModal, connectModalOpen } = (0, import_rainbowkit2.useConnectModal)();
|
|
25171
|
-
const { disconnect } = (0,
|
|
25172
|
-
const { signMessageAsync } = (0,
|
|
25169
|
+
const { disconnect } = (0, import_wagmi7.useDisconnect)();
|
|
25170
|
+
const { signMessageAsync } = (0, import_wagmi7.useSignMessage)();
|
|
25173
25171
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
25174
25172
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
25175
25173
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
@@ -25424,7 +25422,7 @@ function WalletConnectHandler() {
|
|
|
25424
25422
|
]);
|
|
25425
25423
|
return null;
|
|
25426
25424
|
}
|
|
25427
|
-
var import_rainbowkit2, import_react_query54, import_react89,
|
|
25425
|
+
var import_rainbowkit2, import_react_query54, import_react89, import_wagmi7;
|
|
25428
25426
|
var init_WalletConnectHandler = __esm({
|
|
25429
25427
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25430
25428
|
init_ProviderContext();
|
|
@@ -25433,7 +25431,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25433
25431
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25434
25432
|
import_react_query54 = require("@tanstack/react-query");
|
|
25435
25433
|
import_react89 = __toESM(require("react"), 1);
|
|
25436
|
-
|
|
25434
|
+
import_wagmi7 = require("wagmi");
|
|
25437
25435
|
init_wallet();
|
|
25438
25436
|
init_AuthMenu2();
|
|
25439
25437
|
init_useLayoutDataStore();
|
|
@@ -25445,7 +25443,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25445
25443
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25446
25444
|
function DirectWalletHandler() {
|
|
25447
25445
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
25448
|
-
const { address, isConnected, chain, connector } = (0,
|
|
25446
|
+
const { address, isConnected, chain, connector } = (0, import_wagmi8.useAccount)();
|
|
25449
25447
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
25450
25448
|
const externalAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
25451
25449
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
@@ -25489,11 +25487,11 @@ function DirectWalletHandler() {
|
|
|
25489
25487
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25490
25488
|
return null;
|
|
25491
25489
|
}
|
|
25492
|
-
var import_react90,
|
|
25490
|
+
var import_react90, import_wagmi8;
|
|
25493
25491
|
var init_DirectWalletHandler = __esm({
|
|
25494
25492
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25495
25493
|
import_react90 = require("react");
|
|
25496
|
-
|
|
25494
|
+
import_wagmi8 = require("wagmi");
|
|
25497
25495
|
init_ProviderContext();
|
|
25498
25496
|
init_useExternalWalletStore();
|
|
25499
25497
|
}
|
|
@@ -25504,9 +25502,9 @@ function getChainParams(chainCfg) {
|
|
|
25504
25502
|
return {
|
|
25505
25503
|
activeChainId: chainCfg.id,
|
|
25506
25504
|
chainConfig: chainCfg,
|
|
25507
|
-
publicClient: (0,
|
|
25508
|
-
bundlerClient: (0,
|
|
25509
|
-
viemChain: (0,
|
|
25505
|
+
publicClient: (0, import_read19.createPublicClientForChain)(chainCfg.id),
|
|
25506
|
+
bundlerClient: (0, import_read19.createBundlerClientForChain)(chainCfg.id),
|
|
25507
|
+
viemChain: (0, import_read19.getViemChain)(chainCfg.id)
|
|
25510
25508
|
};
|
|
25511
25509
|
}
|
|
25512
25510
|
function waitForStoreHydration() {
|
|
@@ -25532,10 +25530,10 @@ function SessionProvider({ children }) {
|
|
|
25532
25530
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Dialog2, {})
|
|
25533
25531
|
] });
|
|
25534
25532
|
}
|
|
25535
|
-
var
|
|
25533
|
+
var import_read19, import_react91, import_zustand13, import_middleware4, import_jsx_runtime121, useSession, requireActiveChainId;
|
|
25536
25534
|
var init_SessionContext = __esm({
|
|
25537
25535
|
"src/context/SessionContext.tsx"() {
|
|
25538
|
-
|
|
25536
|
+
import_read19 = require("@embarkai/core/read");
|
|
25539
25537
|
import_react91 = require("react");
|
|
25540
25538
|
import_zustand13 = require("zustand");
|
|
25541
25539
|
import_middleware4 = require("zustand/middleware");
|
|
@@ -25607,7 +25605,7 @@ var init_SessionContext = __esm({
|
|
|
25607
25605
|
// Set default chainId after hydration if not persisted
|
|
25608
25606
|
onRehydrateStorage: () => (state) => {
|
|
25609
25607
|
if (!state) return;
|
|
25610
|
-
const hydartedChain = getChainParams((0,
|
|
25608
|
+
const hydartedChain = getChainParams((0, import_read19.getChainConfig)(state.activeChainId || import_read19.DEFAULT_CHAIN_ID));
|
|
25611
25609
|
state.activeChainId = hydartedChain.activeChainId;
|
|
25612
25610
|
state.publicClient = hydartedChain.publicClient;
|
|
25613
25611
|
state.bundlerClient = hydartedChain.bundlerClient;
|
|
@@ -25682,31 +25680,31 @@ function getExplorerUrl() {
|
|
|
25682
25680
|
const paramUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("explorerUrl") || void 0 : void 0;
|
|
25683
25681
|
const net = getSelectedNetwork();
|
|
25684
25682
|
const chainId = requireActiveChainId();
|
|
25685
|
-
const chainConfig = (0,
|
|
25683
|
+
const chainConfig = (0, import_read20.getChainConfig)(chainId);
|
|
25686
25684
|
console.log("[getExplorerUrl] ", paramUrl, chainConfig.blockExplorerUrl);
|
|
25687
25685
|
return paramUrl || chainConfig.blockExplorerUrl;
|
|
25688
25686
|
}
|
|
25689
25687
|
function getBundlerClient() {
|
|
25690
25688
|
const chainId = requireActiveChainId();
|
|
25691
|
-
const chainConfig = (0,
|
|
25692
|
-
const viemChain = (0,
|
|
25689
|
+
const chainConfig = (0, import_read20.getChainConfig)(chainId);
|
|
25690
|
+
const viemChain = (0, import_read20.getViemChain)(chainId);
|
|
25693
25691
|
return (0, import_account_abstraction2.createBundlerClient)({
|
|
25694
25692
|
chain: viemChain,
|
|
25695
25693
|
transport: (0, import_viem19.http)(chainConfig.bundlerUrl, { timeout: 1e4, retryCount: 0, fetchOptions: { mode: "cors" } })
|
|
25696
25694
|
});
|
|
25697
25695
|
}
|
|
25698
|
-
var
|
|
25696
|
+
var import_read20, import_viem19, import_account_abstraction2, BUILD_NETWORK, lumiaBeamTestnet, lumiaPrisma, FUNDER_PK;
|
|
25699
25697
|
var init_base = __esm({
|
|
25700
25698
|
"src/internal/clients/base.ts"() {
|
|
25701
25699
|
init_initial();
|
|
25702
25700
|
init_SessionContext();
|
|
25703
|
-
|
|
25701
|
+
import_read20 = require("@embarkai/core/read");
|
|
25704
25702
|
import_viem19 = require("viem");
|
|
25705
25703
|
import_account_abstraction2 = require("viem/account-abstraction");
|
|
25706
25704
|
init_env();
|
|
25707
25705
|
BUILD_NETWORK = true ? "" : "";
|
|
25708
|
-
lumiaBeamTestnet =
|
|
25709
|
-
lumiaPrisma =
|
|
25706
|
+
lumiaBeamTestnet = import_read20.lumiaTestnetChain;
|
|
25707
|
+
lumiaPrisma = import_read20.lumiaMainnetChain;
|
|
25710
25708
|
FUNDER_PK = getEnvVar("VITE_FUNDER_PK") || "";
|
|
25711
25709
|
}
|
|
25712
25710
|
});
|
|
@@ -26426,7 +26424,7 @@ var init_vaultClient = __esm({
|
|
|
26426
26424
|
|
|
26427
26425
|
// src/internal/auth/keyshare.ts
|
|
26428
26426
|
async function checkKeyshareStatusWithSync(userId) {
|
|
26429
|
-
const serverHasKeyshare = await (0,
|
|
26427
|
+
const serverHasKeyshare = await (0, import_auth21.syncKeyshareStatus)();
|
|
26430
26428
|
return checkKeyshareStatus(userId, serverHasKeyshare);
|
|
26431
26429
|
}
|
|
26432
26430
|
async function checkKeyshareStatus(userId, serverHasKeyshare) {
|
|
@@ -26460,7 +26458,7 @@ async function ensureKeyshareForNewUser(userId, onProgress) {
|
|
|
26460
26458
|
onProgress?.("Setting up secure key management...");
|
|
26461
26459
|
const result = await ensureDkgAndGetOwner(userId);
|
|
26462
26460
|
if (!result.ownerAddress) throw new Error("DKG completed but no owner address received");
|
|
26463
|
-
await (0,
|
|
26461
|
+
await (0, import_auth21.syncKeyshareStatus)();
|
|
26464
26462
|
onProgress?.("Key management setup complete");
|
|
26465
26463
|
return { ownerAddress: result.ownerAddress };
|
|
26466
26464
|
}
|
|
@@ -26545,7 +26543,7 @@ var init_keyshare = __esm({
|
|
|
26545
26543
|
|
|
26546
26544
|
// src/internal/auth/providers/x.ts
|
|
26547
26545
|
async function linkX() {
|
|
26548
|
-
const hasValidToken = await (0,
|
|
26546
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
26549
26547
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
26550
26548
|
throw new Error('Use openSocialAuthPopup("x") to link X account');
|
|
26551
26549
|
}
|
|
@@ -26553,10 +26551,10 @@ async function loginWithX() {
|
|
|
26553
26551
|
throw new Error('Use openSocialAuthPopup("x") to login with X account');
|
|
26554
26552
|
}
|
|
26555
26553
|
async function unlinkX(externalId) {
|
|
26556
|
-
const hasValidToken = await (0,
|
|
26554
|
+
const hasValidToken = await (0, import_auth21.ensureValidToken)();
|
|
26557
26555
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
26558
26556
|
const url = externalId ? `${getTssUrl3()}/api/auth/unlink/x?externalId=${encodeURIComponent(externalId)}` : `${getTssUrl3()}/api/auth/unlink/x`;
|
|
26559
|
-
const response = await (0,
|
|
26557
|
+
const response = await (0, import_auth21.authenticatedFetch)(url, {
|
|
26560
26558
|
method: "DELETE"
|
|
26561
26559
|
});
|
|
26562
26560
|
if (!response.ok) {
|
|
@@ -26587,9 +26585,9 @@ var init_providers = __esm({
|
|
|
26587
26585
|
// src/internal/auth/index.ts
|
|
26588
26586
|
var auth_exports = {};
|
|
26589
26587
|
__export(auth_exports, {
|
|
26590
|
-
JwtTokenManager: () =>
|
|
26588
|
+
JwtTokenManager: () => import_auth21.JwtTokenManager,
|
|
26591
26589
|
authenticateWithPasskey: () => authenticateWithPasskey,
|
|
26592
|
-
authenticatedFetch: () =>
|
|
26590
|
+
authenticatedFetch: () => import_auth21.authenticatedFetch,
|
|
26593
26591
|
beginPasskeyAuthentication: () => beginPasskeyAuthentication,
|
|
26594
26592
|
beginPasskeyLinking: () => beginPasskeyLinking,
|
|
26595
26593
|
beginPasskeyRegistration: () => beginPasskeyRegistration,
|
|
@@ -26599,53 +26597,53 @@ __export(auth_exports, {
|
|
|
26599
26597
|
completePasskeyAuthentication: () => completePasskeyAuthentication,
|
|
26600
26598
|
completePasskeyLinking: () => completePasskeyLinking,
|
|
26601
26599
|
completePasskeyRegistration: () => completePasskeyRegistration,
|
|
26602
|
-
configureJwtModule: () =>
|
|
26600
|
+
configureJwtModule: () => import_auth21.configureJwtModule,
|
|
26603
26601
|
createInitialAuthState: () => createInitialAuthState,
|
|
26604
|
-
createJwtTokenManager: () =>
|
|
26602
|
+
createJwtTokenManager: () => import_auth21.createJwtTokenManager,
|
|
26605
26603
|
createLoginMessage: () => createLoginMessage,
|
|
26606
26604
|
createPasskeyHelpers: () => createPasskeyHelpers,
|
|
26607
26605
|
createSignatureMessage: () => createSignatureMessage,
|
|
26608
26606
|
deriveDemoPrivateKey: () => deriveDemoPrivateKey,
|
|
26609
26607
|
ensureKeyshare: () => ensureKeyshare,
|
|
26610
|
-
ensureValidToken: () =>
|
|
26608
|
+
ensureValidToken: () => import_auth21.ensureValidToken,
|
|
26611
26609
|
fetchProjectName: () => fetchProjectName,
|
|
26612
26610
|
formatDate: () => formatDate,
|
|
26613
26611
|
getKeyshareInfo: () => getKeyshareInfo,
|
|
26614
26612
|
getLinkedProviders: () => getLinkedProviders,
|
|
26615
26613
|
getProviderDisplayInfo: () => getProviderDisplayInfo,
|
|
26616
26614
|
getTssUrl: () => getTssUrl3,
|
|
26617
|
-
getValidTokens: () =>
|
|
26615
|
+
getValidTokens: () => import_auth21.getValidTokens,
|
|
26618
26616
|
hasAvailablePasskeys: () => hasAvailablePasskeys,
|
|
26619
26617
|
hideTelegramWidget: () => hideTelegramWidget,
|
|
26620
26618
|
initTelegramWidget: () => initTelegramWidget,
|
|
26621
26619
|
isWebAuthnSupported: () => isWebAuthnSupported,
|
|
26622
|
-
jwtTokenManager: () =>
|
|
26620
|
+
jwtTokenManager: () => import_auth21.jwtTokenManager,
|
|
26623
26621
|
linkPasskeyWithWebAuthn: () => linkPasskeyWithWebAuthn,
|
|
26624
26622
|
linkTelegram: () => linkTelegram,
|
|
26625
26623
|
linkWallet: () => linkWallet,
|
|
26626
26624
|
linkX: () => linkX,
|
|
26627
|
-
loginWithEmail: () =>
|
|
26628
|
-
loginWithTelegram: () =>
|
|
26629
|
-
loginWithUserId: () =>
|
|
26625
|
+
loginWithEmail: () => import_auth21.loginWithEmail,
|
|
26626
|
+
loginWithTelegram: () => import_auth21.loginWithTelegram,
|
|
26627
|
+
loginWithUserId: () => import_auth21.loginWithUserId,
|
|
26630
26628
|
loginWithX: () => loginWithX,
|
|
26631
|
-
logout: () =>
|
|
26629
|
+
logout: () => import_auth21.logout,
|
|
26632
26630
|
mountTelegramLoginWidget: () => mountTelegramLoginWidget,
|
|
26633
26631
|
registerPasskey: () => registerPasskey,
|
|
26634
26632
|
resetWebAuthnFlags: () => resetWebAuthnFlags,
|
|
26635
26633
|
sendEmailLinkCode: () => sendEmailLinkCode,
|
|
26636
26634
|
showTelegramWidget: () => showTelegramWidget,
|
|
26637
|
-
syncKeyshareStatus: () =>
|
|
26635
|
+
syncKeyshareStatus: () => import_auth21.syncKeyshareStatus,
|
|
26638
26636
|
unlinkProvider: () => unlinkProvider,
|
|
26639
26637
|
unlinkWallet: () => unlinkWallet,
|
|
26640
26638
|
unlinkX: () => unlinkX,
|
|
26641
26639
|
verifyEmailLinkCode: () => verifyEmailLinkCode,
|
|
26642
|
-
verifyToken: () =>
|
|
26640
|
+
verifyToken: () => import_auth21.verifyToken,
|
|
26643
26641
|
walletLogin: () => walletLogin
|
|
26644
26642
|
});
|
|
26645
|
-
var
|
|
26643
|
+
var import_auth21, createInitialAuthState;
|
|
26646
26644
|
var init_auth = __esm({
|
|
26647
26645
|
"src/internal/auth/index.ts"() {
|
|
26648
|
-
|
|
26646
|
+
import_auth21 = require("@embarkai/core/auth");
|
|
26649
26647
|
init_passkeyAuth();
|
|
26650
26648
|
init_telegram();
|
|
26651
26649
|
init_passkey();
|
|
@@ -27947,13 +27945,13 @@ var init_iframe_manager = __esm({
|
|
|
27947
27945
|
});
|
|
27948
27946
|
|
|
27949
27947
|
// src/config/rainbowkit.ts
|
|
27950
|
-
var
|
|
27948
|
+
var import_read21, import_rainbowkit3, import_wallets2, import_wagmi9, import_chains12, getProjectId2, WALLET_MAP, getWagmiStorageKey, buildRainbowChains, createRainbowConfig, rainbowTheme;
|
|
27951
27949
|
var init_rainbowkit = __esm({
|
|
27952
27950
|
"src/config/rainbowkit.ts"() {
|
|
27953
|
-
|
|
27951
|
+
import_read21 = require("@embarkai/core/read");
|
|
27954
27952
|
import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
27955
27953
|
import_wallets2 = require("@rainbow-me/rainbowkit/wallets");
|
|
27956
|
-
|
|
27954
|
+
import_wagmi9 = require("wagmi");
|
|
27957
27955
|
import_chains12 = require("wagmi/chains");
|
|
27958
27956
|
getProjectId2 = (configProjectId) => {
|
|
27959
27957
|
if (configProjectId) return configProjectId;
|
|
@@ -27977,8 +27975,8 @@ var init_rainbowkit = __esm({
|
|
|
27977
27975
|
};
|
|
27978
27976
|
buildRainbowChains = (supportedChains, preferredChainId) => {
|
|
27979
27977
|
const availableChains = [
|
|
27980
|
-
|
|
27981
|
-
|
|
27978
|
+
import_read21.lumiaMainnetChain,
|
|
27979
|
+
import_read21.lumiaTestnetChain,
|
|
27982
27980
|
import_chains12.mainnet,
|
|
27983
27981
|
import_chains12.polygon,
|
|
27984
27982
|
import_chains12.bsc,
|
|
@@ -28004,7 +28002,7 @@ var init_rainbowkit = __esm({
|
|
|
28004
28002
|
appName: "EmbarkAI Wallet",
|
|
28005
28003
|
projectId: getProjectId2(opts.projectId),
|
|
28006
28004
|
chains: buildRainbowChains(opts.supportedChains, opts.preferredChainId),
|
|
28007
|
-
storage: (0,
|
|
28005
|
+
storage: (0, import_wagmi9.createStorage)({ key: getWagmiStorageKey(opts) }),
|
|
28008
28006
|
ssr: false
|
|
28009
28007
|
};
|
|
28010
28008
|
if (opts.allowedWallets && opts.allowedWallets.length > 0) {
|
|
@@ -28234,14 +28232,14 @@ function RainbowKitProvider({ children }) {
|
|
|
28234
28232
|
};
|
|
28235
28233
|
}, [colorMode]);
|
|
28236
28234
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_jsx_runtime122.Fragment, { children });
|
|
28237
|
-
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
28235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_wagmi10.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28238
28236
|
}
|
|
28239
|
-
var import_rainbowkit4, import_react92,
|
|
28237
|
+
var import_rainbowkit4, import_react92, import_wagmi10, import_styles, import_jsx_runtime122;
|
|
28240
28238
|
var init_RainbowKitContext = __esm({
|
|
28241
28239
|
"src/context/RainbowKitContext.tsx"() {
|
|
28242
28240
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
28243
28241
|
import_react92 = require("react");
|
|
28244
|
-
|
|
28242
|
+
import_wagmi10 = require("wagmi");
|
|
28245
28243
|
init_rainbowkit();
|
|
28246
28244
|
init_useLayoutStore();
|
|
28247
28245
|
init_ProviderContext();
|
|
@@ -28266,14 +28264,14 @@ var init_utils11 = __esm({
|
|
|
28266
28264
|
});
|
|
28267
28265
|
|
|
28268
28266
|
// src/context/WagmiContext.tsx
|
|
28269
|
-
var import_core7,
|
|
28267
|
+
var import_core7, import_wagmi11, import_jsx_runtime123, WagmiProvider2;
|
|
28270
28268
|
var init_WagmiContext = __esm({
|
|
28271
28269
|
"src/context/WagmiContext.tsx"() {
|
|
28272
28270
|
import_core7 = require("@embarkai/core");
|
|
28273
|
-
|
|
28271
|
+
import_wagmi11 = require("wagmi");
|
|
28274
28272
|
import_jsx_runtime123 = require("react/jsx-runtime");
|
|
28275
28273
|
WagmiProvider2 = ({ children }) => {
|
|
28276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
28274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_wagmi11.WagmiProvider, { config: import_core7.wagmiConfig, children });
|
|
28277
28275
|
};
|
|
28278
28276
|
}
|
|
28279
28277
|
});
|
|
@@ -28465,9 +28463,9 @@ __export(index_exports, {
|
|
|
28465
28463
|
getUserOperationByHash: () => getUserOperationByHash,
|
|
28466
28464
|
getUserOperationReceipt: () => getUserOperationReceipt,
|
|
28467
28465
|
getUserProfile: () => getUserProfile,
|
|
28468
|
-
getValidTokens: () =>
|
|
28469
|
-
jwtTokenManager: () =>
|
|
28470
|
-
logout: () =>
|
|
28466
|
+
getValidTokens: () => import_auth21.getValidTokens,
|
|
28467
|
+
jwtTokenManager: () => import_auth21.jwtTokenManager,
|
|
28468
|
+
logout: () => import_auth21.logout,
|
|
28471
28469
|
looksLikeNickname: () => looksLikeNickname,
|
|
28472
28470
|
prepareBatchUserOperation: () => prepareBatchUserOperation,
|
|
28473
28471
|
prepareUserOperation: () => prepareUserOperation,
|
|
@@ -28662,11 +28660,11 @@ function ConnectWalletButton(props) {
|
|
|
28662
28660
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
28663
28661
|
queryFn: getUserProfile
|
|
28664
28662
|
});
|
|
28665
|
-
const displayName = profile?.nicknameDisplay || profile?.displayName ||
|
|
28663
|
+
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth21.jwtTokenManager.getDisplayName();
|
|
28666
28664
|
const indicators = (0, import_react94.useMemo)(() => {
|
|
28667
28665
|
const userId = session?.mpcUserId;
|
|
28668
28666
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28669
|
-
const server =
|
|
28667
|
+
const server = import_auth21.jwtTokenManager.getHasKeyshare() ?? false;
|
|
28670
28668
|
const local = !!address;
|
|
28671
28669
|
return { server, local, backup: hasServerVault };
|
|
28672
28670
|
}, [session, address, hasServerVault]);
|
|
@@ -29645,7 +29643,7 @@ function useWalletMode() {
|
|
|
29645
29643
|
// src/hooks/useDirectWallet.ts
|
|
29646
29644
|
var import_react98 = require("react");
|
|
29647
29645
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29648
|
-
var
|
|
29646
|
+
var import_wagmi12 = require("wagmi");
|
|
29649
29647
|
init_useExternalWalletStore();
|
|
29650
29648
|
init_useLayoutDataStore();
|
|
29651
29649
|
function useDirectWallet() {
|
|
@@ -29654,7 +29652,7 @@ function useDirectWallet() {
|
|
|
29654
29652
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29655
29653
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
29656
29654
|
const clearExternalWallet = useExternalWalletStore((st) => st.clearExternalWallet);
|
|
29657
|
-
const { disconnect: wagmiDisconnect } = (0,
|
|
29655
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi12.useDisconnect)();
|
|
29658
29656
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29659
29657
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29660
29658
|
const connect = (0, import_react98.useCallback)(() => {
|
|
@@ -29681,13 +29679,13 @@ function useDirectWallet() {
|
|
|
29681
29679
|
// src/hooks/useSendDirectTransaction.ts
|
|
29682
29680
|
var import_react99 = require("react");
|
|
29683
29681
|
var import_viem20 = require("viem");
|
|
29684
|
-
var
|
|
29682
|
+
var import_wagmi13 = require("wagmi");
|
|
29685
29683
|
init_useExternalWalletStore();
|
|
29686
29684
|
function useSendDirectTransaction() {
|
|
29687
29685
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29688
29686
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29689
|
-
const { sendTransactionAsync } = (0,
|
|
29690
|
-
const { switchChainAsync } = (0,
|
|
29687
|
+
const { sendTransactionAsync } = (0, import_wagmi13.useSendTransaction)();
|
|
29688
|
+
const { switchChainAsync } = (0, import_wagmi13.useSwitchChain)();
|
|
29691
29689
|
const [isPending, setIsPending] = (0, import_react99.useState)(false);
|
|
29692
29690
|
const [error, setError] = (0, import_react99.useState)(null);
|
|
29693
29691
|
const [txHash, setTxHash] = (0, import_react99.useState)(null);
|
|
@@ -29820,11 +29818,11 @@ function useTransferToLinkedWallet() {
|
|
|
29820
29818
|
}
|
|
29821
29819
|
|
|
29822
29820
|
// src/hooks/useNativeWalletSignature.ts
|
|
29823
|
-
var
|
|
29821
|
+
var import_wagmi14 = require("wagmi");
|
|
29824
29822
|
init_providers();
|
|
29825
29823
|
function useNativeWalletSignature() {
|
|
29826
|
-
const signMessage = (0,
|
|
29827
|
-
const signTypedMessage = (0,
|
|
29824
|
+
const signMessage = (0, import_wagmi14.useSignMessage)();
|
|
29825
|
+
const signTypedMessage = (0, import_wagmi14.useSignTypedData)();
|
|
29828
29826
|
return {
|
|
29829
29827
|
signMessage,
|
|
29830
29828
|
/** EIP-712 signature */
|
|
@@ -29834,27 +29832,43 @@ function useNativeWalletSignature() {
|
|
|
29834
29832
|
}
|
|
29835
29833
|
|
|
29836
29834
|
// src/hooks/useLogout.ts
|
|
29837
|
-
var
|
|
29835
|
+
var import_auth23 = require("@embarkai/core/auth");
|
|
29838
29836
|
var import_react101 = require("react");
|
|
29837
|
+
var import_wagmi15 = require("wagmi");
|
|
29839
29838
|
init_ProviderContext();
|
|
29840
29839
|
init_SessionContext();
|
|
29840
|
+
init_useExternalWalletStore();
|
|
29841
29841
|
function useLogout() {
|
|
29842
|
-
const { setSession, setIsLoading, setAddress, setStatus, setError, address } = useSession();
|
|
29843
29842
|
const { callbacksRef } = useProviderConfig();
|
|
29843
|
+
const address = useSession((st) => st.address);
|
|
29844
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi15.useDisconnect)({
|
|
29845
|
+
mutation: {
|
|
29846
|
+
onSuccess: () => {
|
|
29847
|
+
useExternalWalletStore.getState().clearExternalWallet();
|
|
29848
|
+
useExternalWalletStore.getState().setExternalChainId(null);
|
|
29849
|
+
console.log("[ExternalWalletStore] Disconnected from external wallet");
|
|
29850
|
+
},
|
|
29851
|
+
onError: (err) => {
|
|
29852
|
+
console.error("[ExternalWalletStore] Error disconnecting from external wallet:", err);
|
|
29853
|
+
}
|
|
29854
|
+
}
|
|
29855
|
+
});
|
|
29844
29856
|
const logout2 = (0, import_react101.useCallback)(async () => {
|
|
29857
|
+
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
29845
29858
|
const prevAddress = address;
|
|
29846
29859
|
let userId = null;
|
|
29847
29860
|
setIsLoading(true);
|
|
29848
29861
|
try {
|
|
29849
|
-
userId =
|
|
29862
|
+
userId = import_auth23.jwtTokenManager.getUserId() || null;
|
|
29850
29863
|
} catch (error) {
|
|
29851
29864
|
console.warn("[useLogout] Could not get userId:", error);
|
|
29852
29865
|
}
|
|
29853
29866
|
try {
|
|
29854
|
-
await (0,
|
|
29867
|
+
await (0, import_auth23.logout)();
|
|
29855
29868
|
} catch (error) {
|
|
29856
29869
|
console.warn("[useLogout] Core logout failed:", error);
|
|
29857
29870
|
}
|
|
29871
|
+
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
29858
29872
|
setSession(null);
|
|
29859
29873
|
setAddress(null);
|
|
29860
29874
|
setStatus("idle");
|
|
@@ -29868,7 +29882,7 @@ function useLogout() {
|
|
|
29868
29882
|
} catch (error) {
|
|
29869
29883
|
console.warn("[useLogout] Callback error:", error);
|
|
29870
29884
|
}
|
|
29871
|
-
}, [address
|
|
29885
|
+
}, [address]);
|
|
29872
29886
|
return { logout: logout2 };
|
|
29873
29887
|
}
|
|
29874
29888
|
|
|
@@ -29891,15 +29905,15 @@ init_useBlockscoutAssets();
|
|
|
29891
29905
|
|
|
29892
29906
|
// src/modules/transactions.ts
|
|
29893
29907
|
init_SessionContext();
|
|
29894
|
-
var
|
|
29908
|
+
var import_read22 = require("@embarkai/core/read");
|
|
29895
29909
|
var import_viem22 = require("viem");
|
|
29896
|
-
var
|
|
29910
|
+
var import_wagmi16 = require("wagmi");
|
|
29897
29911
|
function useTransactions() {
|
|
29898
29912
|
const chainId = requireActiveChainId();
|
|
29899
|
-
const viemChain = (0,
|
|
29900
|
-
const publicClient = (0,
|
|
29901
|
-
const { data: walletClient } = (0,
|
|
29902
|
-
const { address } = (0,
|
|
29913
|
+
const viemChain = (0, import_read22.getViemChain)(chainId);
|
|
29914
|
+
const publicClient = (0, import_wagmi16.usePublicClient)({ chainId });
|
|
29915
|
+
const { data: walletClient } = (0, import_wagmi16.useWalletClient)();
|
|
29916
|
+
const { address } = (0, import_wagmi16.useAccount)();
|
|
29903
29917
|
const sendTransaction = async (params) => {
|
|
29904
29918
|
if (!walletClient) {
|
|
29905
29919
|
throw new Error("Wallet not connected");
|
|
@@ -29959,7 +29973,7 @@ function useTransactions() {
|
|
|
29959
29973
|
init_SessionContext();
|
|
29960
29974
|
var import_react102 = __toESM(require("react"), 1);
|
|
29961
29975
|
var import_viem23 = require("viem");
|
|
29962
|
-
var
|
|
29976
|
+
var import_wagmi17 = require("wagmi");
|
|
29963
29977
|
var COMMON_TOKENS = [
|
|
29964
29978
|
// Add real token addresses here when available
|
|
29965
29979
|
// {
|
|
@@ -29976,7 +29990,7 @@ function useAssets(address) {
|
|
|
29976
29990
|
data: nativeBalance,
|
|
29977
29991
|
isLoading: nativeBalanceLoading,
|
|
29978
29992
|
refetch: refetchNativeBalance
|
|
29979
|
-
} = (0,
|
|
29993
|
+
} = (0, import_wagmi17.useBalance)({
|
|
29980
29994
|
address,
|
|
29981
29995
|
chainId,
|
|
29982
29996
|
query: {
|
|
@@ -29990,7 +30004,7 @@ function useAssets(address) {
|
|
|
29990
30004
|
args: [address],
|
|
29991
30005
|
chainId
|
|
29992
30006
|
}));
|
|
29993
|
-
const readContractsResult = (0,
|
|
30007
|
+
const readContractsResult = (0, import_wagmi17.useReadContracts)({
|
|
29994
30008
|
contracts: tokenContracts,
|
|
29995
30009
|
query: {
|
|
29996
30010
|
enabled: !!address && COMMON_TOKENS.length > 0
|
|
@@ -30071,7 +30085,7 @@ function useAssets(address) {
|
|
|
30071
30085
|
}
|
|
30072
30086
|
function useTokenInfo(tokenAddress) {
|
|
30073
30087
|
const chainId = requireActiveChainId();
|
|
30074
|
-
const readContractsResult = (0,
|
|
30088
|
+
const readContractsResult = (0, import_wagmi17.useReadContracts)({
|
|
30075
30089
|
contracts: [
|
|
30076
30090
|
{ address: tokenAddress, abi: import_viem23.erc20Abi, functionName: "name", chainId },
|
|
30077
30091
|
{ address: tokenAddress, abi: import_viem23.erc20Abi, functionName: "symbol", chainId },
|
|
@@ -30102,7 +30116,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
30102
30116
|
data: balance,
|
|
30103
30117
|
isLoading,
|
|
30104
30118
|
refetch
|
|
30105
|
-
} = (0,
|
|
30119
|
+
} = (0, import_wagmi17.useReadContract)({
|
|
30106
30120
|
address: tokenAddress,
|
|
30107
30121
|
abi: import_viem23.erc20Abi,
|
|
30108
30122
|
functionName: "balanceOf",
|