@embarkai/ui-kit 0.4.114 → 0.4.116
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 +488 -412
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +179 -106
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7602,6 +7602,7 @@ var init_en = __esm({
|
|
|
7602
7602
|
connectWallet: "Connect Wallet Profile",
|
|
7603
7603
|
noWallets: "No wallets available to connect",
|
|
7604
7604
|
requestPending: "{{wallet}} already has a pending request from this site. Open {{wallet}}, reject or close that request, then try again.",
|
|
7605
|
+
projectInfoUnavailable: "Could not load the app details needed to sign in. Check your connection and try again.",
|
|
7605
7606
|
instructions: {
|
|
7606
7607
|
follow: "Watch your connecting wallet app.\nYou will be asked to:\n {{steps}}",
|
|
7607
7608
|
confirm: "- 1. Confirm your wallet connection into embarkAI",
|
|
@@ -8195,6 +8196,7 @@ var init_ru = __esm({
|
|
|
8195
8196
|
connectWallet: "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430",
|
|
8196
8197
|
noWallets: "\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F",
|
|
8197
8198
|
requestPending: "\u0412 {{wallet}} \u0443\u0436\u0435 \u0432\u0438\u0441\u0438\u0442 \u0437\u0430\u043F\u0440\u043E\u0441 \u043E\u0442 \u044D\u0442\u043E\u0433\u043E \u0441\u0430\u0439\u0442\u0430. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 {{wallet}}, \u043E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u044D\u0442\u043E\u0442 \u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.",
|
|
8199
|
+
projectInfoUnavailable: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.",
|
|
8198
8200
|
instructions: {
|
|
8199
8201
|
follow: "\u0421\u043B\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0430\u0435\u043C\u044B\u043C \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435\u043C \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430.\n\u0412\u0430\u043C \u0431\u0443\u0434\u0435\u0442 \u043F\u0440\u0435\u0434\u043B\u043E\u0436\u0435\u043D\u043E:\n {{steps}}",
|
|
8200
8202
|
confirm: "- 1. \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430 \u043A embarkAI",
|
|
@@ -8788,6 +8790,7 @@ var init_zh = __esm({
|
|
|
8788
8790
|
connectWallet: "\u8FDE\u63A5\u94B1\u5305\u914D\u7F6E\u6587\u4EF6",
|
|
8789
8791
|
noWallets: "\u6CA1\u6709\u53EF\u8FDE\u63A5\u7684\u94B1\u5305",
|
|
8790
8792
|
requestPending: "{{wallet}} \u4E2D\u5DF2\u6709\u6765\u81EA\u672C\u7F51\u7AD9\u7684\u5F85\u5904\u7406\u8BF7\u6C42\u3002\u8BF7\u6253\u5F00 {{wallet}}\uFF0C\u62D2\u7EDD\u6216\u5173\u95ED\u8BE5\u8BF7\u6C42\uFF0C\u7136\u540E\u91CD\u8BD5\u3002",
|
|
8793
|
+
projectInfoUnavailable: "\u65E0\u6CD5\u52A0\u8F7D\u767B\u5F55\u6240\u9700\u7684\u5E94\u7528\u4FE1\u606F\u3002\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u540E\u91CD\u8BD5\u3002",
|
|
8791
8794
|
instructions: {
|
|
8792
8795
|
follow: "\u8BF7\u67E5\u770B\u60A8\u6B63\u5728\u8FDE\u63A5\u7684\u94B1\u5305\u5E94\u7528\u3002\n\u60A8\u5C06\u88AB\u8981\u6C42\uFF1A\n {{steps}}",
|
|
8793
8796
|
confirm: "- 1. \u786E\u8BA4\u5C06\u60A8\u7684\u94B1\u5305\u8FDE\u63A5\u5230 embarkAI",
|
|
@@ -11640,12 +11643,6 @@ var init_AuthMenu = __esm({
|
|
|
11640
11643
|
setAlert(null);
|
|
11641
11644
|
};
|
|
11642
11645
|
}, []);
|
|
11643
|
-
if (!isIframeReady) {
|
|
11644
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Expandable, { isExpanded: true, className: "w-full p-8 flex flex-col justify-center items-center gap-[var(--ui-kit-gap)]", children: [
|
|
11645
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react11.Loader, { className: "w-4 h-4 animate-spin" }),
|
|
11646
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-sm text-[var(--ui-kit-fg-muted)]", children: "Initializing wallet..." })
|
|
11647
|
-
] });
|
|
11648
|
-
}
|
|
11649
11646
|
const stepContent = (0, import_react25.useMemo)(
|
|
11650
11647
|
() => ({
|
|
11651
11648
|
"loading": /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LoadingStep, {}),
|
|
@@ -11663,6 +11660,12 @@ var init_AuthMenu = __esm({
|
|
|
11663
11660
|
}),
|
|
11664
11661
|
[onAuthSuccess, goBackToSignIn]
|
|
11665
11662
|
);
|
|
11663
|
+
if (!isIframeReady) {
|
|
11664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Expandable, { isExpanded: true, className: "w-full p-8 flex flex-col justify-center items-center gap-[var(--ui-kit-gap)]", children: [
|
|
11665
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react11.Loader, { className: "w-4 h-4 animate-spin" }),
|
|
11666
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-sm text-[var(--ui-kit-fg-muted)]", children: "Initializing wallet..." })
|
|
11667
|
+
] });
|
|
11668
|
+
}
|
|
11666
11669
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
11667
11670
|
stepContent[step],
|
|
11668
11671
|
alert2 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Highlight, { type: "error", children: [
|
|
@@ -15735,6 +15738,68 @@ var init_wallets = __esm({
|
|
|
15735
15738
|
}
|
|
15736
15739
|
});
|
|
15737
15740
|
|
|
15741
|
+
// src/internal/lib/disconnect-guard.ts
|
|
15742
|
+
function waitForReconnect(config) {
|
|
15743
|
+
if (config.state.status !== "reconnecting") return Promise.resolve();
|
|
15744
|
+
return new Promise((resolve) => {
|
|
15745
|
+
const unsubscribe = config.subscribe(
|
|
15746
|
+
(state) => state.status,
|
|
15747
|
+
(status) => {
|
|
15748
|
+
if (status === "reconnecting") return;
|
|
15749
|
+
unsubscribe();
|
|
15750
|
+
resolve();
|
|
15751
|
+
}
|
|
15752
|
+
);
|
|
15753
|
+
});
|
|
15754
|
+
}
|
|
15755
|
+
function hasUnusableCurrentConnector(config) {
|
|
15756
|
+
const { current, connections } = config.state;
|
|
15757
|
+
if (!current) return false;
|
|
15758
|
+
const connector = connections.get(current)?.connector;
|
|
15759
|
+
return !!connector && typeof connector.disconnect !== "function";
|
|
15760
|
+
}
|
|
15761
|
+
var init_disconnect_guard = __esm({
|
|
15762
|
+
"src/internal/lib/disconnect-guard.ts"() {
|
|
15763
|
+
}
|
|
15764
|
+
});
|
|
15765
|
+
|
|
15766
|
+
// src/internal/hooks/useSafeDisconnect.ts
|
|
15767
|
+
function useSafeDisconnect(options) {
|
|
15768
|
+
const config = (0, import_wagmi.useConfig)();
|
|
15769
|
+
const mutation = (0, import_wagmi.useDisconnect)(options);
|
|
15770
|
+
const { mutateAsync } = mutation;
|
|
15771
|
+
const disconnectAsync = (0, import_react40.useCallback)(
|
|
15772
|
+
async (parameters) => {
|
|
15773
|
+
await waitForReconnect(config);
|
|
15774
|
+
if (!parameters?.connector && hasUnusableCurrentConnector(config)) return;
|
|
15775
|
+
await mutateAsync(parameters);
|
|
15776
|
+
},
|
|
15777
|
+
[config, mutateAsync]
|
|
15778
|
+
);
|
|
15779
|
+
const disconnect = (0, import_react40.useCallback)(
|
|
15780
|
+
(parameters) => {
|
|
15781
|
+
disconnectAsync(parameters).catch(() => {
|
|
15782
|
+
});
|
|
15783
|
+
},
|
|
15784
|
+
[disconnectAsync]
|
|
15785
|
+
);
|
|
15786
|
+
return {
|
|
15787
|
+
...mutation,
|
|
15788
|
+
mutate: disconnect,
|
|
15789
|
+
mutateAsync: disconnectAsync,
|
|
15790
|
+
disconnect,
|
|
15791
|
+
disconnectAsync
|
|
15792
|
+
};
|
|
15793
|
+
}
|
|
15794
|
+
var import_react40, import_wagmi;
|
|
15795
|
+
var init_useSafeDisconnect = __esm({
|
|
15796
|
+
"src/internal/hooks/useSafeDisconnect.ts"() {
|
|
15797
|
+
import_react40 = require("react");
|
|
15798
|
+
import_wagmi = require("wagmi");
|
|
15799
|
+
init_disconnect_guard();
|
|
15800
|
+
}
|
|
15801
|
+
});
|
|
15802
|
+
|
|
15738
15803
|
// src/internal/lib/connect-errors.ts
|
|
15739
15804
|
function someInErrorChain(error, predicate) {
|
|
15740
15805
|
let current = error;
|
|
@@ -15866,16 +15931,16 @@ function useLinkedProfiles() {
|
|
|
15866
15931
|
}
|
|
15867
15932
|
});
|
|
15868
15933
|
const { profiles = [], avatar = null } = data || {};
|
|
15869
|
-
const refresh = (0,
|
|
15934
|
+
const refresh = (0, import_react41.useCallback)(async () => {
|
|
15870
15935
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15871
15936
|
}, [qc, address]);
|
|
15872
15937
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15873
15938
|
}
|
|
15874
|
-
var import_react_query17,
|
|
15939
|
+
var import_react_query17, import_react41, LINKED_PROFILES_QUERY_KEY;
|
|
15875
15940
|
var init_linkedProfiles = __esm({
|
|
15876
15941
|
"src/modules/linkedProfiles.ts"() {
|
|
15877
15942
|
import_react_query17 = require("@tanstack/react-query");
|
|
15878
|
-
|
|
15943
|
+
import_react41 = require("react");
|
|
15879
15944
|
init_SessionContext();
|
|
15880
15945
|
init_auth();
|
|
15881
15946
|
init_common();
|
|
@@ -15924,20 +15989,27 @@ async function unlinkWallet(address) {
|
|
|
15924
15989
|
throw new Error(errorData.message || `Failed to unlink wallet: ${response.statusText}`);
|
|
15925
15990
|
}
|
|
15926
15991
|
}
|
|
15927
|
-
async function
|
|
15928
|
-
const
|
|
15929
|
-
if (
|
|
15992
|
+
async function requestProjectName(projectId) {
|
|
15993
|
+
const response = await fetch(`${METADATA_API_URL}/${projectId}/metadata`);
|
|
15994
|
+
if (!response.ok) throw new Error(`Project metadata request failed with status ${response.status}`);
|
|
15995
|
+
const metadata = await response.json();
|
|
15996
|
+
if (!metadata?.name) throw new Error("Project metadata has no name");
|
|
15997
|
+
metadataCache = { data: metadata, timestamp: Date.now() };
|
|
15998
|
+
return metadata.name;
|
|
15999
|
+
}
|
|
16000
|
+
async function fetchProjectName(projectId, attempts = 2) {
|
|
16001
|
+
if (metadataCache && Date.now() - metadataCache.timestamp < METADATA_CACHE_TTL) {
|
|
15930
16002
|
return metadataCache.data.name;
|
|
15931
16003
|
}
|
|
15932
|
-
|
|
15933
|
-
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
15938
|
-
|
|
15939
|
-
return "EmbarkAI";
|
|
16004
|
+
let lastError;
|
|
16005
|
+
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
16006
|
+
try {
|
|
16007
|
+
return await requestProjectName(projectId);
|
|
16008
|
+
} catch (error) {
|
|
16009
|
+
lastError = error;
|
|
16010
|
+
}
|
|
15940
16011
|
}
|
|
16012
|
+
throw lastError;
|
|
15941
16013
|
}
|
|
15942
16014
|
function createSignatureMessage(address, projectName, nonce) {
|
|
15943
16015
|
const timestamp = Date.now();
|
|
@@ -16613,7 +16685,7 @@ function useLinkSocial() {
|
|
|
16613
16685
|
} = useProviderConfig();
|
|
16614
16686
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16615
16687
|
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
16616
|
-
const handleLinkSocialProvider =
|
|
16688
|
+
const handleLinkSocialProvider = import_react42.default.useCallback(
|
|
16617
16689
|
async (providerIdRaw) => {
|
|
16618
16690
|
const providerKey = providerIdRaw.toLowerCase();
|
|
16619
16691
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -16671,8 +16743,8 @@ function useLinkSocial() {
|
|
|
16671
16743
|
},
|
|
16672
16744
|
[config.social?.providers]
|
|
16673
16745
|
);
|
|
16674
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
16675
|
-
(0,
|
|
16746
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react42.default.useState(false);
|
|
16747
|
+
(0, import_react42.useEffect)(() => {
|
|
16676
16748
|
const key = providerType?.toLowerCase();
|
|
16677
16749
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted });
|
|
16678
16750
|
if (key && key !== "telegram" && key !== "email" && key !== "passkey" && key !== "wallet") {
|
|
@@ -16686,7 +16758,7 @@ function useLinkSocial() {
|
|
|
16686
16758
|
}
|
|
16687
16759
|
}, [providerType, linkIsLoading, socialLinkStarted, handleLinkSocialProvider]);
|
|
16688
16760
|
}
|
|
16689
|
-
var import_react_query22,
|
|
16761
|
+
var import_react_query22, import_react42;
|
|
16690
16762
|
var init_useLinkSocial = __esm({
|
|
16691
16763
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16692
16764
|
init_useLayoutDataStore();
|
|
@@ -16694,7 +16766,7 @@ var init_useLinkSocial = __esm({
|
|
|
16694
16766
|
init_SessionContext();
|
|
16695
16767
|
init_linkedProfiles();
|
|
16696
16768
|
import_react_query22 = require("@tanstack/react-query");
|
|
16697
|
-
|
|
16769
|
+
import_react42 = __toESM(require("react"), 1);
|
|
16698
16770
|
init_auth();
|
|
16699
16771
|
init_telegramBrowser();
|
|
16700
16772
|
init_useProvidersList();
|
|
@@ -16762,7 +16834,7 @@ function useLinkTelegram() {
|
|
|
16762
16834
|
const address = useSession((st) => st.address);
|
|
16763
16835
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16764
16836
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16765
|
-
const handleLinkTelegram = (0,
|
|
16837
|
+
const handleLinkTelegram = (0, import_react43.useCallback)(async () => {
|
|
16766
16838
|
try {
|
|
16767
16839
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16768
16840
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16809,8 +16881,8 @@ function useLinkTelegram() {
|
|
|
16809
16881
|
setLinkIsLoading(false);
|
|
16810
16882
|
}
|
|
16811
16883
|
}, [config.social?.providers]);
|
|
16812
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
16813
|
-
(0,
|
|
16884
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react43.useState)(false);
|
|
16885
|
+
(0, import_react43.useEffect)(() => {
|
|
16814
16886
|
console.log("[useLinkTelegram] Effect triggered:", { providerType, linkIsLoading, telegramLinkStarted });
|
|
16815
16887
|
if (providerType === "telegram" && !linkIsLoading && !telegramLinkStarted) {
|
|
16816
16888
|
console.log("[useLinkTelegram] Starting Telegram link flow");
|
|
@@ -16818,20 +16890,20 @@ function useLinkTelegram() {
|
|
|
16818
16890
|
handleLinkTelegram();
|
|
16819
16891
|
}
|
|
16820
16892
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted]);
|
|
16821
|
-
(0,
|
|
16893
|
+
(0, import_react43.useEffect)(() => {
|
|
16822
16894
|
if (providerType !== "telegram") {
|
|
16823
16895
|
setTelegramLinkStarted(false);
|
|
16824
16896
|
}
|
|
16825
16897
|
}, [providerType]);
|
|
16826
16898
|
}
|
|
16827
|
-
var import_react_query23,
|
|
16899
|
+
var import_react_query23, import_react43;
|
|
16828
16900
|
var init_useLinkTelegram = __esm({
|
|
16829
16901
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16830
16902
|
init_ProviderContext();
|
|
16831
16903
|
init_SessionContext();
|
|
16832
16904
|
init_linkedProfiles();
|
|
16833
16905
|
import_react_query23 = require("@tanstack/react-query");
|
|
16834
|
-
|
|
16906
|
+
import_react43 = require("react");
|
|
16835
16907
|
init_telegram2();
|
|
16836
16908
|
init_useLayoutDataStore();
|
|
16837
16909
|
init_telegramBrowser();
|
|
@@ -16862,7 +16934,7 @@ function getProviderCaption(provider) {
|
|
|
16862
16934
|
function ProviderCard(props) {
|
|
16863
16935
|
const { provider, meta, externalId, disabled } = props;
|
|
16864
16936
|
const { t } = useT();
|
|
16865
|
-
const connections = (0,
|
|
16937
|
+
const connections = (0, import_wagmi2.useConnections)();
|
|
16866
16938
|
const {
|
|
16867
16939
|
mutate: connectExternalWallet,
|
|
16868
16940
|
disconnect: disconnectExternalWallet,
|
|
@@ -16974,14 +17046,14 @@ function ProviderCard(props) {
|
|
|
16974
17046
|
] })
|
|
16975
17047
|
] });
|
|
16976
17048
|
}
|
|
16977
|
-
var import_lucide_react30,
|
|
17049
|
+
var import_lucide_react30, import_wagmi2, import_jsx_runtime71;
|
|
16978
17050
|
var init_ProviderCard = __esm({
|
|
16979
17051
|
"src/internal/components/ManageWalletMenu/ProviderCard.tsx"() {
|
|
16980
17052
|
init_useLayoutDataStore();
|
|
16981
17053
|
init_useT();
|
|
16982
17054
|
init_wallets();
|
|
16983
17055
|
import_lucide_react30 = require("lucide-react");
|
|
16984
|
-
|
|
17056
|
+
import_wagmi2 = require("wagmi");
|
|
16985
17057
|
init_types();
|
|
16986
17058
|
init_cn();
|
|
16987
17059
|
init_ConnectExternalWalletMenu2();
|
|
@@ -17031,7 +17103,7 @@ function ManageWalletMenu() {
|
|
|
17031
17103
|
} = useManageWalletStore();
|
|
17032
17104
|
const configuredProviders = getConfiguredProviders(config.current);
|
|
17033
17105
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
17034
|
-
const renderProviders = (0,
|
|
17106
|
+
const renderProviders = (0, import_react44.useMemo)(() => {
|
|
17035
17107
|
const normalizeProviderName = (name) => {
|
|
17036
17108
|
if (name === "x") return "twitter";
|
|
17037
17109
|
return name;
|
|
@@ -17156,7 +17228,7 @@ function ManageWalletMenu() {
|
|
|
17156
17228
|
] })
|
|
17157
17229
|
] });
|
|
17158
17230
|
}
|
|
17159
|
-
var import_lodash_es11, import_lucide_react31,
|
|
17231
|
+
var import_lodash_es11, import_lucide_react31, import_react44, import_jsx_runtime72, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
17160
17232
|
var init_ManageWallet = __esm({
|
|
17161
17233
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
17162
17234
|
init_useLayoutDataStore();
|
|
@@ -17165,7 +17237,7 @@ var init_ManageWallet = __esm({
|
|
|
17165
17237
|
init_i18n();
|
|
17166
17238
|
import_lodash_es11 = require("lodash-es");
|
|
17167
17239
|
import_lucide_react31 = require("lucide-react");
|
|
17168
|
-
|
|
17240
|
+
import_react44 = require("react");
|
|
17169
17241
|
init_constants();
|
|
17170
17242
|
init_telegramBrowser();
|
|
17171
17243
|
init_Expandable2();
|
|
@@ -17198,12 +17270,12 @@ function UnlinkProviderMenu() {
|
|
|
17198
17270
|
const qc = (0, import_react_query24.useQueryClient)();
|
|
17199
17271
|
const address = useSession((st) => st.address);
|
|
17200
17272
|
const { callbacksRef } = useProviderConfig();
|
|
17201
|
-
const { disconnect: disconnectExternalWallet } = (
|
|
17273
|
+
const { disconnect: disconnectExternalWallet } = useSafeDisconnect();
|
|
17202
17274
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
17203
17275
|
const { t } = useT();
|
|
17204
17276
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17205
17277
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
17206
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
17278
|
+
const [confirmInput, setConfirmInput] = (0, import_react45.useState)("");
|
|
17207
17279
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query24.useMutation)({
|
|
17208
17280
|
mutationFn: async () => {
|
|
17209
17281
|
if (!confirmUnlink) {
|
|
@@ -17285,18 +17357,18 @@ function UnlinkProviderMenu() {
|
|
|
17285
17357
|
] })
|
|
17286
17358
|
] });
|
|
17287
17359
|
}
|
|
17288
|
-
var import_react_query24, import_lucide_react32,
|
|
17360
|
+
var import_react_query24, import_lucide_react32, import_react45, import_jsx_runtime73;
|
|
17289
17361
|
var init_UnlinkProviderMenu = __esm({
|
|
17290
17362
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
17291
17363
|
init_useLayoutDataStore();
|
|
17292
17364
|
init_ProviderContext();
|
|
17293
17365
|
init_SessionContext();
|
|
17294
17366
|
init_useT();
|
|
17367
|
+
init_useSafeDisconnect();
|
|
17295
17368
|
init_linkedProfiles();
|
|
17296
17369
|
import_react_query24 = require("@tanstack/react-query");
|
|
17297
17370
|
import_lucide_react32 = require("lucide-react");
|
|
17298
|
-
|
|
17299
|
-
import_wagmi2 = require("wagmi");
|
|
17371
|
+
import_react45 = require("react");
|
|
17300
17372
|
init_auth();
|
|
17301
17373
|
init_useExternalWalletStore();
|
|
17302
17374
|
init_button();
|
|
@@ -17336,8 +17408,8 @@ var init_ManageWalletMenu = __esm({
|
|
|
17336
17408
|
|
|
17337
17409
|
// src/internal/components/ConnectExternalWalletMenu/useConnectExternalWalletMenuParams.ts
|
|
17338
17410
|
function useConnectExternalWalletMenuParams() {
|
|
17339
|
-
const paramsRef = (0,
|
|
17340
|
-
(0,
|
|
17411
|
+
const paramsRef = (0, import_react46.useRef)(null);
|
|
17412
|
+
(0, import_react46.useEffect)(() => {
|
|
17341
17413
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
17342
17414
|
if (!pageParams || !(0, import_lodash_es12.keys)(pageParams).length) return;
|
|
17343
17415
|
paramsRef.current = pageParams;
|
|
@@ -17345,11 +17417,11 @@ function useConnectExternalWalletMenuParams() {
|
|
|
17345
17417
|
}, []);
|
|
17346
17418
|
return paramsRef;
|
|
17347
17419
|
}
|
|
17348
|
-
var import_lodash_es12,
|
|
17420
|
+
var import_lodash_es12, import_react46;
|
|
17349
17421
|
var init_useConnectExternalWalletMenuParams = __esm({
|
|
17350
17422
|
"src/internal/components/ConnectExternalWalletMenu/useConnectExternalWalletMenuParams.ts"() {
|
|
17351
17423
|
import_lodash_es12 = require("lodash-es");
|
|
17352
|
-
|
|
17424
|
+
import_react46 = require("react");
|
|
17353
17425
|
init_useLayoutDataStore();
|
|
17354
17426
|
}
|
|
17355
17427
|
});
|
|
@@ -17360,18 +17432,18 @@ function hasInjectedWallet() {
|
|
|
17360
17432
|
return mipdStore.getProviders().length > 0 || !!window.ethereum;
|
|
17361
17433
|
}
|
|
17362
17434
|
function useHasInjectedWallet() {
|
|
17363
|
-
return (0,
|
|
17435
|
+
return (0, import_react47.useSyncExternalStore)(
|
|
17364
17436
|
(onStoreChange) => mipdStore?.subscribe(onStoreChange) ?? (() => {
|
|
17365
17437
|
}),
|
|
17366
17438
|
hasInjectedWallet,
|
|
17367
17439
|
() => false
|
|
17368
17440
|
);
|
|
17369
17441
|
}
|
|
17370
|
-
var import_mipd,
|
|
17442
|
+
var import_mipd, import_react47, mipdStore;
|
|
17371
17443
|
var init_useHasInjectedWallet = __esm({
|
|
17372
17444
|
"src/internal/components/ConnectExternalWalletMenu/useHasInjectedWallet.ts"() {
|
|
17373
17445
|
import_mipd = require("mipd");
|
|
17374
|
-
|
|
17446
|
+
import_react47 = require("react");
|
|
17375
17447
|
mipdStore = typeof window !== "undefined" ? (0, import_mipd.createStore)() : void 0;
|
|
17376
17448
|
}
|
|
17377
17449
|
});
|
|
@@ -17396,11 +17468,11 @@ function ConnectExternalWalletMenu() {
|
|
|
17396
17468
|
const wagmiConfig3 = (0, import_wagmi3.useConfig)();
|
|
17397
17469
|
const chains = (0, import_wagmi3.useChains)();
|
|
17398
17470
|
const connections = (0, import_wagmi3.useConnections)();
|
|
17399
|
-
const { mutate: disconnect, mutateAsync: disconnectAsync } = (
|
|
17471
|
+
const { mutate: disconnect, mutateAsync: disconnectAsync } = useSafeDisconnect();
|
|
17400
17472
|
const { mutateAsync: signMessageAsync } = (0, import_wagmi3.useSignMessage)();
|
|
17401
17473
|
const { mutateAsync: switchChainAsync } = (0, import_wagmi3.useSwitchChain)();
|
|
17402
17474
|
const { mutateAsync: switchConnectionAsync } = (0, import_wagmi3.useSwitchConnection)();
|
|
17403
|
-
const [isPreparingConnect, setIsPreparingConnect] = (0,
|
|
17475
|
+
const [isPreparingConnect, setIsPreparingConnect] = (0, import_react48.useState)(false);
|
|
17404
17476
|
const signOnSupportedChain = async (params) => {
|
|
17405
17477
|
const { connector, account, message } = params;
|
|
17406
17478
|
const signOnce = async (viaFallback = false) => {
|
|
@@ -17427,7 +17499,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17427
17499
|
queryKey: [PROVIDERS_QUERY_KEY, embarkAiAddress],
|
|
17428
17500
|
queryFn: async () => getLinkedProviders()
|
|
17429
17501
|
});
|
|
17430
|
-
const [connectError, setConnectError] = (0,
|
|
17502
|
+
const [connectError, setConnectError] = (0, import_react48.useState)(null);
|
|
17431
17503
|
const { mutateAsync: onLinkingComplete } = (0, import_react_query25.useMutation)({
|
|
17432
17504
|
mutationFn: async (success) => {
|
|
17433
17505
|
useManageWalletStore.getState().setProviderType(null);
|
|
@@ -17524,7 +17596,9 @@ function ConnectExternalWalletMenu() {
|
|
|
17524
17596
|
return;
|
|
17525
17597
|
}
|
|
17526
17598
|
const projectId = config.current?.projectId;
|
|
17527
|
-
const projectName = projectId ? await fetchProjectName(projectId)
|
|
17599
|
+
const projectName = projectId ? await fetchProjectName(projectId).catch(() => {
|
|
17600
|
+
throw new Error(t("passport:connectMenu.projectInfoUnavailable"));
|
|
17601
|
+
}) : "EmbarkAI";
|
|
17528
17602
|
const createMessage = connectFlowType === "auth" ? createLoginMessage : createSignatureMessage;
|
|
17529
17603
|
const message = createMessage(signingWalletAddress, projectName);
|
|
17530
17604
|
const { signature, chainId: signedChainId } = await signOnSupportedChain({
|
|
@@ -17581,7 +17655,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17581
17655
|
}, 100);
|
|
17582
17656
|
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17583
17657
|
}
|
|
17584
|
-
const visibleConnectors = (0,
|
|
17658
|
+
const visibleConnectors = (0, import_react48.useMemo)(() => {
|
|
17585
17659
|
const seen = /* @__PURE__ */ new Set();
|
|
17586
17660
|
const unique = connectors.filter((connector) => {
|
|
17587
17661
|
const skipConnector = seen.has(connector.uid);
|
|
@@ -17599,7 +17673,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17599
17673
|
(connector) => allowed.includes(connector.id.toLowerCase()) || allowed.includes(connector.name.toLowerCase())
|
|
17600
17674
|
);
|
|
17601
17675
|
}, [connectors, allowedWallets, hasInjectedWallet2]);
|
|
17602
|
-
const getInstructionSteps = (0,
|
|
17676
|
+
const getInstructionSteps = (0, import_react48.useCallback)(() => {
|
|
17603
17677
|
const connectFlowType = getConnectFlowType({
|
|
17604
17678
|
isEmbarkAI: !!embarkAiAddress,
|
|
17605
17679
|
connectFlow: menuParams.current?.connectFlowType || "auth"
|
|
@@ -17707,7 +17781,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17707
17781
|
] })
|
|
17708
17782
|
] });
|
|
17709
17783
|
}
|
|
17710
|
-
var import_react_query25, import_lucide_react33,
|
|
17784
|
+
var import_react_query25, import_lucide_react33, import_react48, import_wagmi3, import_chains, import_jsx_runtime74, SIGN_FALLBACK_CHAIN_ID;
|
|
17711
17785
|
var init_ConnectExternalWalletMenu = __esm({
|
|
17712
17786
|
"src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx"() {
|
|
17713
17787
|
init_ProviderContext();
|
|
@@ -17715,11 +17789,12 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17715
17789
|
init_useOpenPage();
|
|
17716
17790
|
init_i18n();
|
|
17717
17791
|
init_wallets();
|
|
17792
|
+
init_useSafeDisconnect();
|
|
17718
17793
|
init_connect_errors();
|
|
17719
17794
|
init_linkedProfiles();
|
|
17720
17795
|
import_react_query25 = require("@tanstack/react-query");
|
|
17721
17796
|
import_lucide_react33 = require("lucide-react");
|
|
17722
|
-
|
|
17797
|
+
import_react48 = require("react");
|
|
17723
17798
|
import_wagmi3 = require("wagmi");
|
|
17724
17799
|
import_chains = require("wagmi/chains");
|
|
17725
17800
|
init_common();
|
|
@@ -17747,13 +17822,13 @@ function useExternalWalletConnnect(options) {
|
|
|
17747
17822
|
const connectors = (0, import_wagmi4.useConnectors)();
|
|
17748
17823
|
const connections = (0, import_wagmi4.useConnections)();
|
|
17749
17824
|
const { mutate: connect, mutateAsync: connectAsync, ...restUseConnect } = (0, import_wagmi4.useConnect)();
|
|
17750
|
-
const { mutateAsync: disconnectAsync } = (
|
|
17751
|
-
const disconnectExternalWallet = (0,
|
|
17825
|
+
const { mutateAsync: disconnectAsync } = useSafeDisconnect();
|
|
17826
|
+
const disconnectExternalWallet = (0, import_react49.useCallback)(async () => {
|
|
17752
17827
|
await disconnectAsync();
|
|
17753
17828
|
const { externalAddress, clearExternalWallet } = useExternalWalletStore.getState();
|
|
17754
17829
|
if (!!externalAddress) clearExternalWallet();
|
|
17755
17830
|
}, [disconnectAsync]);
|
|
17756
|
-
const connectExternalWallet = (0,
|
|
17831
|
+
const connectExternalWallet = (0, import_react49.useCallback)(
|
|
17757
17832
|
async (walletConnectorType) => {
|
|
17758
17833
|
const connector = connectors.find((c) => c.id === walletConnectorType);
|
|
17759
17834
|
if (!connector) {
|
|
@@ -17807,12 +17882,13 @@ function useExternalWalletConnnect(options) {
|
|
|
17807
17882
|
...(0, import_lodash_es13.omit)(restUseConnect, ["mutate", "mutateAsync"])
|
|
17808
17883
|
};
|
|
17809
17884
|
}
|
|
17810
|
-
var import_lodash_es13,
|
|
17885
|
+
var import_lodash_es13, import_react49, import_wagmi4;
|
|
17811
17886
|
var init_useExternalWalletConnect = __esm({
|
|
17812
17887
|
"src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts"() {
|
|
17813
17888
|
init_ProviderContext();
|
|
17889
|
+
init_useSafeDisconnect();
|
|
17814
17890
|
import_lodash_es13 = require("lodash-es");
|
|
17815
|
-
|
|
17891
|
+
import_react49 = require("react");
|
|
17816
17892
|
import_wagmi4 = require("wagmi");
|
|
17817
17893
|
init_useLayoutStore();
|
|
17818
17894
|
init_connect_errors();
|
|
@@ -17905,8 +17981,8 @@ function getErrorMessage(err) {
|
|
|
17905
17981
|
function DeviceLinkScreen() {
|
|
17906
17982
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
17907
17983
|
const { mutate: link, isPending } = useLinkDevice();
|
|
17908
|
-
const [code, setCode] = (0,
|
|
17909
|
-
const [error, setError] = (0,
|
|
17984
|
+
const [code, setCode] = (0, import_react50.useState)("");
|
|
17985
|
+
const [error, setError] = (0, import_react50.useState)(null);
|
|
17910
17986
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
17911
17987
|
function handleCodeChange(value) {
|
|
17912
17988
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -17948,11 +18024,11 @@ function DeviceLinkScreen() {
|
|
|
17948
18024
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Button, { variant: "default", size: "large", className: "w-full", disabled: !isValid || isPending, onClick: handleLink, children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react34.Loader2, { className: "w-4 h-4 animate-spin" }) : "Link" })
|
|
17949
18025
|
] });
|
|
17950
18026
|
}
|
|
17951
|
-
var import_lucide_react34,
|
|
18027
|
+
var import_lucide_react34, import_react50, import_jsx_runtime75, VALID_CHARS;
|
|
17952
18028
|
var init_DeviceLinkScreen = __esm({
|
|
17953
18029
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
17954
18030
|
import_lucide_react34 = require("lucide-react");
|
|
17955
|
-
|
|
18031
|
+
import_react50 = require("react");
|
|
17956
18032
|
init_devices();
|
|
17957
18033
|
init_useLayoutDataStore();
|
|
17958
18034
|
init_Expandable2();
|
|
@@ -18491,19 +18567,19 @@ function DeviceManageScreen() {
|
|
|
18491
18567
|
const userId = session?.mpcUserId || "";
|
|
18492
18568
|
const deviceId = pageParams?.deviceId;
|
|
18493
18569
|
const deviceName = pageParams?.deviceName;
|
|
18494
|
-
const guardianRef = (0,
|
|
18495
|
-
const [screen, setScreen] = (0,
|
|
18496
|
-
const [actionState, setActionState] = (0,
|
|
18497
|
-
const [password, setPassword] = (0,
|
|
18498
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18499
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18500
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
18501
|
-
(0,
|
|
18570
|
+
const guardianRef = (0, import_react51.useRef)(null);
|
|
18571
|
+
const [screen, setScreen] = (0, import_react51.useState)({ step: "connecting" });
|
|
18572
|
+
const [actionState, setActionState] = (0, import_react51.useState)(null);
|
|
18573
|
+
const [password, setPassword] = (0, import_react51.useState)("");
|
|
18574
|
+
const [statusMessage, setStatusMessage] = (0, import_react51.useState)(null);
|
|
18575
|
+
const [errorMessage, setErrorMessage] = (0, import_react51.useState)(null);
|
|
18576
|
+
const [waitingConfirm, setWaitingConfirm] = (0, import_react51.useState)(false);
|
|
18577
|
+
(0, import_react51.useEffect)(() => {
|
|
18502
18578
|
if (!statusMessage) return;
|
|
18503
18579
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
18504
18580
|
return () => clearTimeout(t);
|
|
18505
18581
|
}, [statusMessage]);
|
|
18506
|
-
(0,
|
|
18582
|
+
(0, import_react51.useEffect)(() => {
|
|
18507
18583
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
18508
18584
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
18509
18585
|
return;
|
|
@@ -18535,7 +18611,7 @@ function DeviceManageScreen() {
|
|
|
18535
18611
|
guardianRef.current?.close();
|
|
18536
18612
|
};
|
|
18537
18613
|
}, [deviceId]);
|
|
18538
|
-
const refreshList = (0,
|
|
18614
|
+
const refreshList = (0, import_react51.useCallback)(async () => {
|
|
18539
18615
|
const guardian = guardianRef.current;
|
|
18540
18616
|
if (!guardian || screen.step !== "connected") return;
|
|
18541
18617
|
try {
|
|
@@ -18544,7 +18620,7 @@ function DeviceManageScreen() {
|
|
|
18544
18620
|
} catch {
|
|
18545
18621
|
}
|
|
18546
18622
|
}, [screen]);
|
|
18547
|
-
const handleBackup = (0,
|
|
18623
|
+
const handleBackup = (0, import_react51.useCallback)(async () => {
|
|
18548
18624
|
const guardian = guardianRef.current;
|
|
18549
18625
|
const iframe6 = getIframeManager();
|
|
18550
18626
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18568,7 +18644,7 @@ function DeviceManageScreen() {
|
|
|
18568
18644
|
setActionState(null);
|
|
18569
18645
|
}
|
|
18570
18646
|
}, [password, userId, refreshList]);
|
|
18571
|
-
const handleOverwrite = (0,
|
|
18647
|
+
const handleOverwrite = (0, import_react51.useCallback)(async () => {
|
|
18572
18648
|
const guardian = guardianRef.current;
|
|
18573
18649
|
const iframe6 = getIframeManager();
|
|
18574
18650
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18588,7 +18664,7 @@ function DeviceManageScreen() {
|
|
|
18588
18664
|
setActionState(null);
|
|
18589
18665
|
}
|
|
18590
18666
|
}, [password, userId, refreshList]);
|
|
18591
|
-
const handleDelete = (0,
|
|
18667
|
+
const handleDelete = (0, import_react51.useCallback)(
|
|
18592
18668
|
async (keyshareId) => {
|
|
18593
18669
|
const guardian = guardianRef.current;
|
|
18594
18670
|
if (!guardian) return;
|
|
@@ -18775,12 +18851,12 @@ function DeviceManageScreen() {
|
|
|
18775
18851
|
] })
|
|
18776
18852
|
] });
|
|
18777
18853
|
}
|
|
18778
|
-
var import_lucide_react35,
|
|
18854
|
+
var import_lucide_react35, import_react51, import_jsx_runtime76;
|
|
18779
18855
|
var init_DeviceManageScreen = __esm({
|
|
18780
18856
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
18781
18857
|
init_SessionContext();
|
|
18782
18858
|
import_lucide_react35 = require("lucide-react");
|
|
18783
|
-
|
|
18859
|
+
import_react51 = require("react");
|
|
18784
18860
|
init_guardian_backup();
|
|
18785
18861
|
init_useLayoutDataStore();
|
|
18786
18862
|
init_iframe_manager();
|
|
@@ -18799,11 +18875,11 @@ function DeviceRestoreScreen() {
|
|
|
18799
18875
|
const keyshareId = pageParams?.keyshareId;
|
|
18800
18876
|
const deviceId = pageParams?.deviceId;
|
|
18801
18877
|
const deviceName = pageParams?.deviceName;
|
|
18802
|
-
const [password, setPassword] = (0,
|
|
18803
|
-
const [isWorking, setIsWorking] = (0,
|
|
18804
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18805
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18806
|
-
const handleRestore = (0,
|
|
18878
|
+
const [password, setPassword] = (0, import_react52.useState)("");
|
|
18879
|
+
const [isWorking, setIsWorking] = (0, import_react52.useState)(false);
|
|
18880
|
+
const [statusMessage, setStatusMessage] = (0, import_react52.useState)(null);
|
|
18881
|
+
const [errorMessage, setErrorMessage] = (0, import_react52.useState)(null);
|
|
18882
|
+
const handleRestore = (0, import_react52.useCallback)(async () => {
|
|
18807
18883
|
if (!password || !keyshareId || !userId) return;
|
|
18808
18884
|
const iframe6 = getIframeManager();
|
|
18809
18885
|
if (!iframe6) {
|
|
@@ -18883,12 +18959,12 @@ function DeviceRestoreScreen() {
|
|
|
18883
18959
|
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "text-sm text-[var(--ui-kit-bg-error)] p-2 text-center", children: errorMessage })
|
|
18884
18960
|
] });
|
|
18885
18961
|
}
|
|
18886
|
-
var import_lucide_react36,
|
|
18962
|
+
var import_lucide_react36, import_react52, import_jsx_runtime77;
|
|
18887
18963
|
var init_DeviceRestoreScreen = __esm({
|
|
18888
18964
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
18889
18965
|
init_SessionContext();
|
|
18890
18966
|
import_lucide_react36 = require("lucide-react");
|
|
18891
|
-
|
|
18967
|
+
import_react52 = require("react");
|
|
18892
18968
|
init_guardian_backup();
|
|
18893
18969
|
init_useLayoutDataStore();
|
|
18894
18970
|
init_iframe_manager();
|
|
@@ -18908,8 +18984,8 @@ function truncateAddress(address) {
|
|
|
18908
18984
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
18909
18985
|
}
|
|
18910
18986
|
function DeviceRow({ device }) {
|
|
18911
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
18912
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
18987
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react53.useState)(false);
|
|
18988
|
+
const [unlinkError, setUnlinkError] = (0, import_react53.useState)(null);
|
|
18913
18989
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
18914
18990
|
if (confirmingUnlink) {
|
|
18915
18991
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-lg bg-[var(--ui-kit-bg)]", children: [
|
|
@@ -19010,11 +19086,11 @@ function DevicesMenu() {
|
|
|
19010
19086
|
] })
|
|
19011
19087
|
] });
|
|
19012
19088
|
}
|
|
19013
|
-
var import_lucide_react37,
|
|
19089
|
+
var import_lucide_react37, import_react53, import_jsx_runtime78;
|
|
19014
19090
|
var init_DevicesMenu = __esm({
|
|
19015
19091
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
19016
19092
|
import_lucide_react37 = require("lucide-react");
|
|
19017
|
-
|
|
19093
|
+
import_react53 = require("react");
|
|
19018
19094
|
init_devices();
|
|
19019
19095
|
init_guardian_backup();
|
|
19020
19096
|
init_useLayoutDataStore();
|
|
@@ -19074,7 +19150,7 @@ function useOnRestoreSuccess() {
|
|
|
19074
19150
|
setStatus
|
|
19075
19151
|
} = useSession();
|
|
19076
19152
|
const { setError, setSuccess } = useRestoreStore();
|
|
19077
|
-
const createSessionWithKeyshare = (0,
|
|
19153
|
+
const createSessionWithKeyshare = (0, import_react54.useCallback)(
|
|
19078
19154
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
19079
19155
|
try {
|
|
19080
19156
|
try {
|
|
@@ -19115,7 +19191,7 @@ function useOnRestoreSuccess() {
|
|
|
19115
19191
|
},
|
|
19116
19192
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
19117
19193
|
);
|
|
19118
|
-
const onRestoreSuccess = (0,
|
|
19194
|
+
const onRestoreSuccess = (0, import_react54.useCallback)(async () => {
|
|
19119
19195
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
19120
19196
|
const verify = await verifyToken2();
|
|
19121
19197
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -19181,12 +19257,12 @@ function useOnRestoreSuccess() {
|
|
|
19181
19257
|
]);
|
|
19182
19258
|
return { onRestoreSuccess };
|
|
19183
19259
|
}
|
|
19184
|
-
var
|
|
19260
|
+
var import_react54;
|
|
19185
19261
|
var init_useOnRestoreSuccess = __esm({
|
|
19186
19262
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
19187
19263
|
init_ProviderContext();
|
|
19188
19264
|
init_SessionContext();
|
|
19189
|
-
|
|
19265
|
+
import_react54 = require("react");
|
|
19190
19266
|
init_useLayoutDataStore();
|
|
19191
19267
|
init_useLayoutStore();
|
|
19192
19268
|
init_useRestoreStore();
|
|
@@ -19449,7 +19525,7 @@ function useCreateBackup() {
|
|
|
19449
19525
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
19450
19526
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
19451
19527
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
19452
|
-
(0,
|
|
19528
|
+
(0, import_react55.useEffect)(() => {
|
|
19453
19529
|
if (!hasServerVault) {
|
|
19454
19530
|
useRestoreStore.getState().setMethod("server");
|
|
19455
19531
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -19457,7 +19533,7 @@ function useCreateBackup() {
|
|
|
19457
19533
|
}, [hasServerVault]);
|
|
19458
19534
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
19459
19535
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
19460
|
-
const onBackupSuccess = (0,
|
|
19536
|
+
const onBackupSuccess = (0, import_react55.useCallback)((method) => {
|
|
19461
19537
|
console.log(`[EMBARKAI BACKUP] ${method} backup created successfully`);
|
|
19462
19538
|
if (method !== "server") return;
|
|
19463
19539
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
@@ -19630,12 +19706,12 @@ function useCreateBackup() {
|
|
|
19630
19706
|
createPasskey
|
|
19631
19707
|
};
|
|
19632
19708
|
}
|
|
19633
|
-
var import_react_query27,
|
|
19709
|
+
var import_react_query27, import_react55;
|
|
19634
19710
|
var init_useCreateBackup = __esm({
|
|
19635
19711
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
19636
19712
|
init_SessionContext();
|
|
19637
19713
|
import_react_query27 = require("@tanstack/react-query");
|
|
19638
|
-
|
|
19714
|
+
import_react55 = require("react");
|
|
19639
19715
|
init_auth();
|
|
19640
19716
|
init_useLayoutDataStore();
|
|
19641
19717
|
init_useLayoutStore();
|
|
@@ -19772,7 +19848,7 @@ function useValidateFileBackup() {
|
|
|
19772
19848
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
19773
19849
|
const setError = useRestoreStore((st) => st.setError);
|
|
19774
19850
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
19775
|
-
(0,
|
|
19851
|
+
(0, import_react56.useEffect)(() => {
|
|
19776
19852
|
if (!restoreFile) {
|
|
19777
19853
|
return;
|
|
19778
19854
|
}
|
|
@@ -19793,10 +19869,10 @@ function useValidateFileBackup() {
|
|
|
19793
19869
|
reader.readAsText(restoreFile);
|
|
19794
19870
|
}, [restoreFile]);
|
|
19795
19871
|
}
|
|
19796
|
-
var
|
|
19872
|
+
var import_react56;
|
|
19797
19873
|
var init_useValidateFileBackup = __esm({
|
|
19798
19874
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
19799
|
-
|
|
19875
|
+
import_react56 = require("react");
|
|
19800
19876
|
init_useRestoreStore();
|
|
19801
19877
|
}
|
|
19802
19878
|
});
|
|
@@ -19824,7 +19900,7 @@ function MethodSelector(props) {
|
|
|
19824
19900
|
setError,
|
|
19825
19901
|
setSuccess
|
|
19826
19902
|
} = useRestoreStore();
|
|
19827
|
-
const recoveryRenderMethods = (0,
|
|
19903
|
+
const recoveryRenderMethods = (0, import_react57.useMemo)(() => {
|
|
19828
19904
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
19829
19905
|
let data = null;
|
|
19830
19906
|
switch (true) {
|
|
@@ -19839,7 +19915,7 @@ function MethodSelector(props) {
|
|
|
19839
19915
|
return methodsWithBackupData;
|
|
19840
19916
|
}, [mode, serverRecoveryStatus]);
|
|
19841
19917
|
if (!!selectedRecoveryMethod) return null;
|
|
19842
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
19918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react57.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
19843
19919
|
"div",
|
|
19844
19920
|
{
|
|
19845
19921
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -19873,12 +19949,12 @@ function MethodSelector(props) {
|
|
|
19873
19949
|
}
|
|
19874
19950
|
) });
|
|
19875
19951
|
}
|
|
19876
|
-
var import_lucide_react38,
|
|
19952
|
+
var import_lucide_react38, import_react57, import_jsx_runtime79, getRecoveryRenderMethods;
|
|
19877
19953
|
var init_MethodSelector = __esm({
|
|
19878
19954
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
19879
19955
|
init_useT();
|
|
19880
19956
|
import_lucide_react38 = require("lucide-react");
|
|
19881
|
-
|
|
19957
|
+
import_react57 = require("react");
|
|
19882
19958
|
init_icons();
|
|
19883
19959
|
init_guardian_backup();
|
|
19884
19960
|
init_button();
|
|
@@ -20014,7 +20090,7 @@ function PasswordPasskey(props) {
|
|
|
20014
20090
|
onCreatePasskey
|
|
20015
20091
|
} = props;
|
|
20016
20092
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
20017
|
-
const actionRef = (0,
|
|
20093
|
+
const actionRef = (0, import_react58.useRef)(null);
|
|
20018
20094
|
const {
|
|
20019
20095
|
showPassword,
|
|
20020
20096
|
restorePassword,
|
|
@@ -20028,7 +20104,7 @@ function PasswordPasskey(props) {
|
|
|
20028
20104
|
} = useRestoreStore();
|
|
20029
20105
|
const { config } = useProviderConfig();
|
|
20030
20106
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
20031
|
-
(0,
|
|
20107
|
+
(0, import_react58.useEffect)(() => {
|
|
20032
20108
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
20033
20109
|
}, [isPasskeyEnabled, usePasskey]);
|
|
20034
20110
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
@@ -20192,7 +20268,7 @@ function PasswordPasskey(props) {
|
|
|
20192
20268
|
] })
|
|
20193
20269
|
] });
|
|
20194
20270
|
}
|
|
20195
|
-
var import_lucide_react39,
|
|
20271
|
+
var import_lucide_react39, import_react58, import_jsx_runtime80;
|
|
20196
20272
|
var init_PasswordPasskey = __esm({
|
|
20197
20273
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
20198
20274
|
init_ProviderContext();
|
|
@@ -20200,7 +20276,7 @@ var init_PasswordPasskey = __esm({
|
|
|
20200
20276
|
init_i18n();
|
|
20201
20277
|
init_utils();
|
|
20202
20278
|
import_lucide_react39 = require("lucide-react");
|
|
20203
|
-
|
|
20279
|
+
import_react58 = require("react");
|
|
20204
20280
|
init_icons();
|
|
20205
20281
|
init_Onboarding();
|
|
20206
20282
|
init_button();
|
|
@@ -20377,7 +20453,7 @@ function Server(props) {
|
|
|
20377
20453
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
20378
20454
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
20379
20455
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
20380
|
-
(0,
|
|
20456
|
+
(0, import_react59.useEffect)(() => {
|
|
20381
20457
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
20382
20458
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
20383
20459
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -20420,7 +20496,7 @@ function Server(props) {
|
|
|
20420
20496
|
)
|
|
20421
20497
|
] });
|
|
20422
20498
|
}
|
|
20423
|
-
var import_react_query29, import_dayjs4, import_lucide_react42,
|
|
20499
|
+
var import_react_query29, import_dayjs4, import_lucide_react42, import_react59, import_jsx_runtime83;
|
|
20424
20500
|
var init_Server = __esm({
|
|
20425
20501
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
20426
20502
|
init_SessionContext();
|
|
@@ -20429,7 +20505,7 @@ var init_Server = __esm({
|
|
|
20429
20505
|
import_react_query29 = require("@tanstack/react-query");
|
|
20430
20506
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
20431
20507
|
import_lucide_react42 = require("lucide-react");
|
|
20432
|
-
|
|
20508
|
+
import_react59 = require("react");
|
|
20433
20509
|
init_Onboarding();
|
|
20434
20510
|
init_highlight();
|
|
20435
20511
|
init_PasswordPasskey();
|
|
@@ -20593,7 +20669,7 @@ function Cloud2(props) {
|
|
|
20593
20669
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
20594
20670
|
}
|
|
20595
20671
|
});
|
|
20596
|
-
(0,
|
|
20672
|
+
(0, import_react60.useEffect)(() => {
|
|
20597
20673
|
if (isCloudProvidersLoading) return;
|
|
20598
20674
|
if (!!cloudProvidersError) {
|
|
20599
20675
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -20657,13 +20733,13 @@ function Cloud2(props) {
|
|
|
20657
20733
|
)
|
|
20658
20734
|
] });
|
|
20659
20735
|
}
|
|
20660
|
-
var import_react_query30, import_lucide_react44,
|
|
20736
|
+
var import_react_query30, import_lucide_react44, import_react60, import_jsx_runtime85;
|
|
20661
20737
|
var init_Cloud = __esm({
|
|
20662
20738
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
20663
20739
|
init_SessionContext();
|
|
20664
20740
|
import_react_query30 = require("@tanstack/react-query");
|
|
20665
20741
|
import_lucide_react44 = require("lucide-react");
|
|
20666
|
-
|
|
20742
|
+
import_react60 = require("react");
|
|
20667
20743
|
init_button();
|
|
20668
20744
|
init_select();
|
|
20669
20745
|
init_PasswordPasskey();
|
|
@@ -20680,8 +20756,8 @@ function Guardian(props) {
|
|
|
20680
20756
|
const session = useSession((st) => st.session);
|
|
20681
20757
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
20682
20758
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
20683
|
-
const [isWorking, setIsWorking] = (0,
|
|
20684
|
-
const [step, setStep] = (0,
|
|
20759
|
+
const [isWorking, setIsWorking] = (0, import_react61.useState)(false);
|
|
20760
|
+
const [step, setStep] = (0, import_react61.useState)("idle");
|
|
20685
20761
|
const handleGuardianBackup = async () => {
|
|
20686
20762
|
if (!restorePassword) {
|
|
20687
20763
|
setError("Please enter a password");
|
|
@@ -20810,11 +20886,11 @@ function Guardian(props) {
|
|
|
20810
20886
|
] })
|
|
20811
20887
|
] });
|
|
20812
20888
|
}
|
|
20813
|
-
var
|
|
20889
|
+
var import_react61, import_lucide_react45, import_jsx_runtime86;
|
|
20814
20890
|
var init_Guardian = __esm({
|
|
20815
20891
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
20816
20892
|
init_SessionContext();
|
|
20817
|
-
|
|
20893
|
+
import_react61 = require("react");
|
|
20818
20894
|
import_lucide_react45 = require("lucide-react");
|
|
20819
20895
|
init_iframe_manager();
|
|
20820
20896
|
init_guardian_backup();
|
|
@@ -20837,16 +20913,16 @@ var init_methods = __esm({
|
|
|
20837
20913
|
});
|
|
20838
20914
|
|
|
20839
20915
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
20840
|
-
var import_react_query31, import_lucide_react46,
|
|
20916
|
+
var import_react_query31, import_lucide_react46, import_react62, import_jsx_runtime87, RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
20841
20917
|
var init_KeyshareRestoreMenu = __esm({
|
|
20842
20918
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
20843
20919
|
init_ProviderContext();
|
|
20844
20920
|
init_SessionContext();
|
|
20845
20921
|
init_i18n();
|
|
20922
|
+
init_useSafeDisconnect();
|
|
20846
20923
|
import_react_query31 = require("@tanstack/react-query");
|
|
20847
20924
|
import_lucide_react46 = require("lucide-react");
|
|
20848
|
-
|
|
20849
|
-
import_wagmi5 = require("wagmi");
|
|
20925
|
+
import_react62 = require("react");
|
|
20850
20926
|
init_useLayoutDataStore();
|
|
20851
20927
|
init_useLayoutStore();
|
|
20852
20928
|
init_useExternalWalletStore();
|
|
@@ -20875,7 +20951,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20875
20951
|
const error = useRestoreStore((st) => st.error);
|
|
20876
20952
|
const success = useRestoreStore((st) => st.success);
|
|
20877
20953
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
20878
|
-
(0,
|
|
20954
|
+
(0, import_react62.useEffect)(() => {
|
|
20879
20955
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
20880
20956
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
20881
20957
|
setIsDialogForced(true);
|
|
@@ -20888,7 +20964,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20888
20964
|
setIsDialogForced(false);
|
|
20889
20965
|
};
|
|
20890
20966
|
}, []);
|
|
20891
|
-
const { mutate: wagmiDisconnect } = (
|
|
20967
|
+
const { mutate: wagmiDisconnect } = useSafeDisconnect({
|
|
20892
20968
|
mutation: {
|
|
20893
20969
|
onSuccess: () => {
|
|
20894
20970
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
@@ -20914,7 +20990,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20914
20990
|
queryFn: async () => await getShareRecoveryStats()
|
|
20915
20991
|
});
|
|
20916
20992
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
20917
|
-
(0,
|
|
20993
|
+
(0, import_react62.useEffect)(() => {
|
|
20918
20994
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
20919
20995
|
}, [hasServerBackup]);
|
|
20920
20996
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query31.useMutation)({
|
|
@@ -21061,7 +21137,7 @@ function KeyshareBackupMenu() {
|
|
|
21061
21137
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
21062
21138
|
const error = useRestoreStore((st) => st.error);
|
|
21063
21139
|
const success = useRestoreStore((st) => st.success);
|
|
21064
|
-
(0,
|
|
21140
|
+
(0, import_react63.useEffect)(() => {
|
|
21065
21141
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
21066
21142
|
return () => {
|
|
21067
21143
|
setSuccess(null);
|
|
@@ -21081,7 +21157,7 @@ function KeyshareBackupMenu() {
|
|
|
21081
21157
|
});
|
|
21082
21158
|
useOnboardingTourAvailable(!isRecoveryLoading && currentBackupMethod === "server" && !usePasskey);
|
|
21083
21159
|
const hasRecoveryData2 = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
21084
|
-
(0,
|
|
21160
|
+
(0, import_react63.useEffect)(() => {
|
|
21085
21161
|
if (!!hasRecoveryData2) useRestoreStore.getState().setMethod("server");
|
|
21086
21162
|
}, [hasRecoveryData2]);
|
|
21087
21163
|
const {
|
|
@@ -21200,14 +21276,14 @@ function KeyshareBackupMenu() {
|
|
|
21200
21276
|
] })
|
|
21201
21277
|
] });
|
|
21202
21278
|
}
|
|
21203
|
-
var import_react_query32, import_lucide_react47,
|
|
21279
|
+
var import_react_query32, import_lucide_react47, import_react63, import_jsx_runtime88, COMPONENTS;
|
|
21204
21280
|
var init_KeyshareBackupMenu = __esm({
|
|
21205
21281
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
21206
21282
|
init_SessionContext();
|
|
21207
21283
|
init_i18n();
|
|
21208
21284
|
import_react_query32 = require("@tanstack/react-query");
|
|
21209
21285
|
import_lucide_react47 = require("lucide-react");
|
|
21210
|
-
|
|
21286
|
+
import_react63 = require("react");
|
|
21211
21287
|
init_useLayoutDataStore();
|
|
21212
21288
|
init_vaultClient();
|
|
21213
21289
|
init_Expandable2();
|
|
@@ -21335,13 +21411,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
21335
21411
|
function useSumsubIframe({ iframeUrl }) {
|
|
21336
21412
|
const config = useProviderConfig().config;
|
|
21337
21413
|
const { colorMode } = useColorMode();
|
|
21338
|
-
const iframeRef = (0,
|
|
21339
|
-
const [isLoading, setIsLoading] = (0,
|
|
21340
|
-
const [error, setError] = (0,
|
|
21341
|
-
const [height, setHeight] = (0,
|
|
21342
|
-
const [status, setStatus] = (0,
|
|
21414
|
+
const iframeRef = (0, import_react64.useRef)(null);
|
|
21415
|
+
const [isLoading, setIsLoading] = (0, import_react64.useState)(true);
|
|
21416
|
+
const [error, setError] = (0, import_react64.useState)(null);
|
|
21417
|
+
const [height, setHeight] = (0, import_react64.useState)(0);
|
|
21418
|
+
const [status, setStatus] = (0, import_react64.useState)("");
|
|
21343
21419
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
21344
|
-
(0,
|
|
21420
|
+
(0, import_react64.useEffect)(() => {
|
|
21345
21421
|
setError(null);
|
|
21346
21422
|
setIsLoading(true);
|
|
21347
21423
|
setStatus("Preparing verification...");
|
|
@@ -21382,12 +21458,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
21382
21458
|
status
|
|
21383
21459
|
};
|
|
21384
21460
|
}
|
|
21385
|
-
var
|
|
21461
|
+
var import_react64;
|
|
21386
21462
|
var init_useSumsubIframe = __esm({
|
|
21387
21463
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
21388
21464
|
init_ProviderContext();
|
|
21389
21465
|
init_useColorMode();
|
|
21390
|
-
|
|
21466
|
+
import_react64 = require("react");
|
|
21391
21467
|
init_sumsub();
|
|
21392
21468
|
init_SumsubIframeManager();
|
|
21393
21469
|
}
|
|
@@ -21595,11 +21671,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21595
21671
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
21596
21672
|
const resolvedChainId = chainId ?? activeChainId;
|
|
21597
21673
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
21598
|
-
const chainConfig = (0,
|
|
21674
|
+
const chainConfig = (0, import_react65.useMemo)(() => {
|
|
21599
21675
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
21600
21676
|
return (0, import_read16.getChainConfig)(chainId);
|
|
21601
21677
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
21602
|
-
const publicClient = (0,
|
|
21678
|
+
const publicClient = (0, import_react65.useMemo)(() => {
|
|
21603
21679
|
if (shouldUseActiveClient) return activePublicClient;
|
|
21604
21680
|
if (!chainId) return activePublicClient;
|
|
21605
21681
|
try {
|
|
@@ -21616,12 +21692,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21616
21692
|
resolvedChainId
|
|
21617
21693
|
};
|
|
21618
21694
|
}
|
|
21619
|
-
var import_read16,
|
|
21695
|
+
var import_read16, import_react65, publicClientByChainId;
|
|
21620
21696
|
var init_useResolvedPublicClient = __esm({
|
|
21621
21697
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
21622
21698
|
init_SessionContext();
|
|
21623
21699
|
import_read16 = require("@embarkai/core/read");
|
|
21624
|
-
|
|
21700
|
+
import_react65 = require("react");
|
|
21625
21701
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
21626
21702
|
}
|
|
21627
21703
|
});
|
|
@@ -21685,7 +21761,7 @@ var init_useNativeBalance = __esm({
|
|
|
21685
21761
|
function useWatchTokens(options) {
|
|
21686
21762
|
const { address, chainId, enabled, publicClient } = options;
|
|
21687
21763
|
const { config } = useProviderConfig();
|
|
21688
|
-
const watchTokens = (0,
|
|
21764
|
+
const watchTokens = (0, import_react66.useMemo)(() => {
|
|
21689
21765
|
const allWatchTokens = config.current.watchTokens;
|
|
21690
21766
|
const tokensForChain = chainId ? allWatchTokens?.[chainId] || [] : [];
|
|
21691
21767
|
return tokensForChain;
|
|
@@ -21753,12 +21829,12 @@ function useWatchTokens(options) {
|
|
|
21753
21829
|
}
|
|
21754
21830
|
});
|
|
21755
21831
|
}
|
|
21756
|
-
var import_react_query35,
|
|
21832
|
+
var import_react_query35, import_react66, import_viem8;
|
|
21757
21833
|
var init_useWatchTokens = __esm({
|
|
21758
21834
|
"src/internal/hooks/useBlockscoutAssets/useWatchTokens.ts"() {
|
|
21759
21835
|
init_ProviderContext();
|
|
21760
21836
|
import_react_query35 = require("@tanstack/react-query");
|
|
21761
|
-
|
|
21837
|
+
import_react66 = require("react");
|
|
21762
21838
|
import_viem8 = require("viem");
|
|
21763
21839
|
init_constants6();
|
|
21764
21840
|
}
|
|
@@ -21907,11 +21983,11 @@ function useBlockscoutAssets(options) {
|
|
|
21907
21983
|
tokenBalancesQueryKey: customTokenBalancesQueryKey
|
|
21908
21984
|
} = useProviderConfig().config?.current?.portfolio || {};
|
|
21909
21985
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
21910
|
-
const blockscoutClient = (0,
|
|
21986
|
+
const blockscoutClient = (0, import_react67.useMemo)(
|
|
21911
21987
|
() => blockscoutApiUrl ? (0, import_core4.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
21912
21988
|
[blockscoutApiUrl]
|
|
21913
21989
|
);
|
|
21914
|
-
const lastRefreshRef = (0,
|
|
21990
|
+
const lastRefreshRef = (0, import_react67.useRef)(0);
|
|
21915
21991
|
const {
|
|
21916
21992
|
data: watchTokenAssets = [],
|
|
21917
21993
|
isLoading: watchTokensLoading,
|
|
@@ -21983,7 +22059,7 @@ function useBlockscoutAssets(options) {
|
|
|
21983
22059
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, blockscoutApiUrl, address],
|
|
21984
22060
|
queryFn: () => blockscoutClient.getNfts(address)
|
|
21985
22061
|
});
|
|
21986
|
-
const erc20TokenAddresses = (0,
|
|
22062
|
+
const erc20TokenAddresses = (0, import_react67.useMemo)(() => {
|
|
21987
22063
|
if (!blockscoutItems) return [];
|
|
21988
22064
|
return blockscoutItems.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
21989
22065
|
}, [blockscoutItems]);
|
|
@@ -22028,7 +22104,7 @@ function useBlockscoutAssets(options) {
|
|
|
22028
22104
|
// 1 minute
|
|
22029
22105
|
// gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
22030
22106
|
});
|
|
22031
|
-
const assets = (0,
|
|
22107
|
+
const assets = (0, import_react67.useMemo)(() => {
|
|
22032
22108
|
const result = [];
|
|
22033
22109
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
22034
22110
|
if (nativeBalanceData) {
|
|
@@ -22122,7 +22198,7 @@ function useBlockscoutAssets(options) {
|
|
|
22122
22198
|
watchTokenAssets,
|
|
22123
22199
|
chainConfig
|
|
22124
22200
|
]);
|
|
22125
|
-
const nativeBalance = (0,
|
|
22201
|
+
const nativeBalance = (0, import_react67.useMemo)(() => {
|
|
22126
22202
|
if (!nativeBalanceData) return null;
|
|
22127
22203
|
return {
|
|
22128
22204
|
value: nativeBalanceData.value,
|
|
@@ -22130,11 +22206,11 @@ function useBlockscoutAssets(options) {
|
|
|
22130
22206
|
symbol: nativeBalanceData.symbol
|
|
22131
22207
|
};
|
|
22132
22208
|
}, [nativeBalanceData]);
|
|
22133
|
-
const error = (0,
|
|
22209
|
+
const error = (0, import_react67.useMemo)(() => {
|
|
22134
22210
|
if (!blockscoutError) return null;
|
|
22135
22211
|
return createError(blockscoutError);
|
|
22136
22212
|
}, [blockscoutError]);
|
|
22137
|
-
const refreshBalances = (0,
|
|
22213
|
+
const refreshBalances = (0, import_react67.useCallback)(async () => {
|
|
22138
22214
|
const now = Date.now();
|
|
22139
22215
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
22140
22216
|
return;
|
|
@@ -22150,7 +22226,7 @@ function useBlockscoutAssets(options) {
|
|
|
22150
22226
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
22151
22227
|
]);
|
|
22152
22228
|
}, [qc, customTokenBalancesQueryKey]);
|
|
22153
|
-
const getTokenBalance = (0,
|
|
22229
|
+
const getTokenBalance = (0, import_react67.useCallback)(
|
|
22154
22230
|
(tokenAddress) => {
|
|
22155
22231
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
22156
22232
|
},
|
|
@@ -22169,13 +22245,13 @@ function useBlockscoutAssets(options) {
|
|
|
22169
22245
|
lastUpdated: dataUpdatedAt || null
|
|
22170
22246
|
};
|
|
22171
22247
|
}
|
|
22172
|
-
var import_core4, import_react_query36,
|
|
22248
|
+
var import_core4, import_react_query36, import_react67;
|
|
22173
22249
|
var init_useBlockscoutAssets = __esm({
|
|
22174
22250
|
"src/internal/hooks/useBlockscoutAssets/useBlockscoutAssets.ts"() {
|
|
22175
22251
|
init_ProviderContext();
|
|
22176
22252
|
import_core4 = require("@embarkai/core");
|
|
22177
22253
|
import_react_query36 = require("@tanstack/react-query");
|
|
22178
|
-
|
|
22254
|
+
import_react67 = require("react");
|
|
22179
22255
|
init_initial();
|
|
22180
22256
|
init_constants();
|
|
22181
22257
|
init_useResolvedPublicClient();
|
|
@@ -22295,9 +22371,9 @@ function SecurityTokenBadge() {
|
|
|
22295
22371
|
}
|
|
22296
22372
|
function PortfolioItemImage(props) {
|
|
22297
22373
|
const { asset } = props;
|
|
22298
|
-
const [logoError, setLogoError] = (0,
|
|
22299
|
-
const [nftImageError, setNftImageError] = (0,
|
|
22300
|
-
const resolvedImage = (0,
|
|
22374
|
+
const [logoError, setLogoError] = (0, import_react68.useState)(false);
|
|
22375
|
+
const [nftImageError, setNftImageError] = (0, import_react68.useState)(false);
|
|
22376
|
+
const resolvedImage = (0, import_react68.useMemo)(() => {
|
|
22301
22377
|
const isNft = isNftAsset(asset);
|
|
22302
22378
|
const nftImage = getNftImage(asset);
|
|
22303
22379
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -22452,13 +22528,13 @@ function PortfolioItem(props) {
|
|
|
22452
22528
|
}
|
|
22453
22529
|
);
|
|
22454
22530
|
}
|
|
22455
|
-
var import_react_query37, import_lucide_react51,
|
|
22531
|
+
var import_react_query37, import_lucide_react51, import_react68, import_viem11, import_jsx_runtime94, PORTFOLIO_ASSET_RATE_QUERY_KEY;
|
|
22456
22532
|
var init_PortfolioItem = __esm({
|
|
22457
22533
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
22458
22534
|
init_ProviderContext();
|
|
22459
22535
|
import_react_query37 = require("@tanstack/react-query");
|
|
22460
22536
|
import_lucide_react51 = require("lucide-react");
|
|
22461
|
-
|
|
22537
|
+
import_react68 = require("react");
|
|
22462
22538
|
import_viem11 = require("viem");
|
|
22463
22539
|
init_tokens();
|
|
22464
22540
|
init_base3();
|
|
@@ -22490,7 +22566,7 @@ function PortfolioMenu() {
|
|
|
22490
22566
|
enabled: !!address
|
|
22491
22567
|
});
|
|
22492
22568
|
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
22493
|
-
const refreshAllAssetsBalances = (0,
|
|
22569
|
+
const refreshAllAssetsBalances = (0, import_react69.useCallback)(() => {
|
|
22494
22570
|
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
22495
22571
|
refreshBlockscoutBalances();
|
|
22496
22572
|
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
@@ -22536,7 +22612,7 @@ function PortfolioMenu() {
|
|
|
22536
22612
|
blockscoutError && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Highlight, { type: "error", children: blockscoutError?.message })
|
|
22537
22613
|
] });
|
|
22538
22614
|
}
|
|
22539
|
-
var import_react_query38, import_lucide_react52,
|
|
22615
|
+
var import_react_query38, import_lucide_react52, import_react69, import_jsx_runtime95;
|
|
22540
22616
|
var init_PortfolioMenu = __esm({
|
|
22541
22617
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
22542
22618
|
init_ProviderContext();
|
|
@@ -22544,7 +22620,7 @@ var init_PortfolioMenu = __esm({
|
|
|
22544
22620
|
init_i18n();
|
|
22545
22621
|
import_react_query38 = require("@tanstack/react-query");
|
|
22546
22622
|
import_lucide_react52 = require("lucide-react");
|
|
22547
|
-
|
|
22623
|
+
import_react69 = require("react");
|
|
22548
22624
|
init_useBlockscoutAssets2();
|
|
22549
22625
|
init_useLayoutDataStore();
|
|
22550
22626
|
init_Expandable2();
|
|
@@ -22855,7 +22931,7 @@ var init_useNicknameStore = __esm({
|
|
|
22855
22931
|
function useNicknameAvailability(currentNickname) {
|
|
22856
22932
|
const { t } = useT();
|
|
22857
22933
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22858
|
-
(0,
|
|
22934
|
+
(0, import_react70.useEffect)(() => {
|
|
22859
22935
|
if (!currentNickname) return;
|
|
22860
22936
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
22861
22937
|
}, [currentNickname]);
|
|
@@ -22876,8 +22952,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22876
22952
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
22877
22953
|
}
|
|
22878
22954
|
});
|
|
22879
|
-
const debouncedCheckAvailability = (0,
|
|
22880
|
-
(0,
|
|
22955
|
+
const debouncedCheckAvailability = (0, import_react70.useCallback)((0, import_lodash_es14.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
22956
|
+
(0, import_react70.useEffect)(() => {
|
|
22881
22957
|
if (!currentNickname) return;
|
|
22882
22958
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
22883
22959
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -22891,13 +22967,13 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22891
22967
|
}, [nicknameValue, currentNickname, debouncedCheckAvailability]);
|
|
22892
22968
|
return { isCheckingAvailability };
|
|
22893
22969
|
}
|
|
22894
|
-
var import_react_query39, import_lodash_es14,
|
|
22970
|
+
var import_react_query39, import_lodash_es14, import_react70, DEBOUNCE_MS;
|
|
22895
22971
|
var init_useNicknameAvailability = __esm({
|
|
22896
22972
|
"src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
|
|
22897
22973
|
init_i18n();
|
|
22898
22974
|
import_react_query39 = require("@tanstack/react-query");
|
|
22899
22975
|
import_lodash_es14 = require("lodash-es");
|
|
22900
|
-
|
|
22976
|
+
import_react70 = require("react");
|
|
22901
22977
|
init_nickname();
|
|
22902
22978
|
init_nickname_errors();
|
|
22903
22979
|
init_nickname_validation();
|
|
@@ -22918,9 +22994,9 @@ function NicknameEditForm(props) {
|
|
|
22918
22994
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22919
22995
|
const nicknameAvailability = useNicknameStore((st) => st.availability);
|
|
22920
22996
|
const { isCheckingAvailability } = useNicknameAvailability(nicknameInfo ? nicknameInfo.handle : "");
|
|
22921
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
22922
|
-
const exitTimerRef = (0,
|
|
22923
|
-
(0,
|
|
22997
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react71.useState)(false);
|
|
22998
|
+
const exitTimerRef = (0, import_react71.useRef)(null);
|
|
22999
|
+
(0, import_react71.useEffect)(() => () => {
|
|
22924
23000
|
if (exitTimerRef.current) clearTimeout(exitTimerRef.current);
|
|
22925
23001
|
}, []);
|
|
22926
23002
|
const { mutate: changeNickname2, isPending: isNicknameChanging } = (0, import_react_query40.useMutation)({
|
|
@@ -22954,7 +23030,7 @@ function NicknameEditForm(props) {
|
|
|
22954
23030
|
);
|
|
22955
23031
|
}
|
|
22956
23032
|
});
|
|
22957
|
-
const handleNicknameInputChange = (0,
|
|
23033
|
+
const handleNicknameInputChange = (0, import_react71.useCallback)(
|
|
22958
23034
|
(e) => {
|
|
22959
23035
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
22960
23036
|
const nextInputValue = e.target.value;
|
|
@@ -22968,7 +23044,7 @@ function NicknameEditForm(props) {
|
|
|
22968
23044
|
},
|
|
22969
23045
|
[t]
|
|
22970
23046
|
);
|
|
22971
|
-
const handleSubmit = (0,
|
|
23047
|
+
const handleSubmit = (0, import_react71.useCallback)(
|
|
22972
23048
|
(e) => {
|
|
22973
23049
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
22974
23050
|
if (!canChange) {
|
|
@@ -23060,7 +23136,7 @@ function NicknameEditForm(props) {
|
|
|
23060
23136
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:nicknameMenu.hint") })
|
|
23061
23137
|
] });
|
|
23062
23138
|
}
|
|
23063
|
-
var import_react_query40, import_lucide_react55,
|
|
23139
|
+
var import_react_query40, import_lucide_react55, import_react71, import_jsx_runtime98;
|
|
23064
23140
|
var init_NicknameEditForm = __esm({
|
|
23065
23141
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
23066
23142
|
init_ProviderContext();
|
|
@@ -23068,7 +23144,7 @@ var init_NicknameEditForm = __esm({
|
|
|
23068
23144
|
init_i18n();
|
|
23069
23145
|
import_react_query40 = require("@tanstack/react-query");
|
|
23070
23146
|
import_lucide_react55 = require("lucide-react");
|
|
23071
|
-
|
|
23147
|
+
import_react71 = require("react");
|
|
23072
23148
|
init_icons();
|
|
23073
23149
|
init_nickname();
|
|
23074
23150
|
init_profile();
|
|
@@ -23104,7 +23180,7 @@ function NicknameMenu() {
|
|
|
23104
23180
|
queryFn: async () => await getNicknameInfo()
|
|
23105
23181
|
});
|
|
23106
23182
|
const resolvedError = nicknameError || nicknameInfoError?.message || null;
|
|
23107
|
-
(0,
|
|
23183
|
+
(0, import_react72.useEffect)(() => () => useNicknameStore.getState().reset(), []);
|
|
23108
23184
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
23109
23185
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)] ", children: [
|
|
23110
23186
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
@@ -23171,7 +23247,7 @@ function NicknameMenu() {
|
|
|
23171
23247
|
!!resolvedError?.length && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Highlight, { type: "error", children: resolvedError })
|
|
23172
23248
|
] });
|
|
23173
23249
|
}
|
|
23174
|
-
var import_react_query41, import_dayjs5, import_lucide_react56,
|
|
23250
|
+
var import_react_query41, import_dayjs5, import_lucide_react56, import_react72, import_jsx_runtime99;
|
|
23175
23251
|
var init_NicknameMenu = __esm({
|
|
23176
23252
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
23177
23253
|
init_SessionContext();
|
|
@@ -23180,7 +23256,7 @@ var init_NicknameMenu = __esm({
|
|
|
23180
23256
|
import_react_query41 = require("@tanstack/react-query");
|
|
23181
23257
|
import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
23182
23258
|
import_lucide_react56 = require("lucide-react");
|
|
23183
|
-
|
|
23259
|
+
import_react72 = require("react");
|
|
23184
23260
|
init_nickname();
|
|
23185
23261
|
init_profile();
|
|
23186
23262
|
init_useLayoutDataStore();
|
|
@@ -23310,12 +23386,12 @@ function ReceiveMenu() {
|
|
|
23310
23386
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
23311
23387
|
queryFn: async () => await getNicknameInfo()
|
|
23312
23388
|
});
|
|
23313
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
23314
|
-
const [isAddressCopied, setAddressCopied] = (0,
|
|
23315
|
-
const [isNicknameCopied, setNicknameCopied] = (0,
|
|
23316
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
23389
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react73.useState)("");
|
|
23390
|
+
const [isAddressCopied, setAddressCopied] = (0, import_react73.useState)(false);
|
|
23391
|
+
const [isNicknameCopied, setNicknameCopied] = (0, import_react73.useState)(false);
|
|
23392
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react73.useState)(false);
|
|
23317
23393
|
useOnboardingTourAvailable(true);
|
|
23318
|
-
const fingerprint = (0,
|
|
23394
|
+
const fingerprint = (0, import_react73.useMemo)(() => {
|
|
23319
23395
|
if (!session?.ownerAddress) return null;
|
|
23320
23396
|
try {
|
|
23321
23397
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -23323,7 +23399,7 @@ function ReceiveMenu() {
|
|
|
23323
23399
|
return null;
|
|
23324
23400
|
}
|
|
23325
23401
|
}, [session?.ownerAddress]);
|
|
23326
|
-
(0,
|
|
23402
|
+
(0, import_react73.useEffect)(() => {
|
|
23327
23403
|
if (!address) return;
|
|
23328
23404
|
import_qrcode.default.toDataURL(address, {
|
|
23329
23405
|
width: 200,
|
|
@@ -23422,7 +23498,7 @@ function ReceiveMenu() {
|
|
|
23422
23498
|
] })
|
|
23423
23499
|
] });
|
|
23424
23500
|
}
|
|
23425
|
-
var import_react_query42, import_lucide_react57, import_qrcode,
|
|
23501
|
+
var import_react_query42, import_lucide_react57, import_qrcode, import_react73, import_jsx_runtime100;
|
|
23426
23502
|
var init_ReceiveMenu = __esm({
|
|
23427
23503
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
23428
23504
|
init_SessionContext();
|
|
@@ -23430,7 +23506,7 @@ var init_ReceiveMenu = __esm({
|
|
|
23430
23506
|
import_react_query42 = require("@tanstack/react-query");
|
|
23431
23507
|
import_lucide_react57 = require("lucide-react");
|
|
23432
23508
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
23433
|
-
|
|
23509
|
+
import_react73 = require("react");
|
|
23434
23510
|
init_nickname();
|
|
23435
23511
|
init_profile();
|
|
23436
23512
|
init_useLayoutDataStore();
|
|
@@ -23810,14 +23886,14 @@ var init_ConnectedApps2 = __esm({
|
|
|
23810
23886
|
});
|
|
23811
23887
|
|
|
23812
23888
|
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
23813
|
-
var import_lucide_react60,
|
|
23889
|
+
var import_lucide_react60, import_react74, import_jsx_runtime103, KeyshareStatus;
|
|
23814
23890
|
var init_KeyshareStatus = __esm({
|
|
23815
23891
|
"src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx"() {
|
|
23816
23892
|
import_lucide_react60 = require("lucide-react");
|
|
23817
|
-
|
|
23893
|
+
import_react74 = require("react");
|
|
23818
23894
|
init_utils();
|
|
23819
23895
|
import_jsx_runtime103 = require("react/jsx-runtime");
|
|
23820
|
-
KeyshareStatus = (0,
|
|
23896
|
+
KeyshareStatus = (0, import_react74.forwardRef)((props, ref) => {
|
|
23821
23897
|
const { isLoading, content, icon: Icon2, children } = props;
|
|
23822
23898
|
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react60.Loader, { className: "w-4 h-4 animate-spin" });
|
|
23823
23899
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { ref, className: "group relative w-full h-full", children: [
|
|
@@ -24144,10 +24220,10 @@ function updateLimits(patch) {
|
|
|
24144
24220
|
usePolicyForm.setState((st) => ({ ...st, limits: { ...st?.limits, ...patch } }));
|
|
24145
24221
|
}
|
|
24146
24222
|
function useWatchFormData() {
|
|
24147
|
-
const [showFormErrors, setShowFormErrors] = (0,
|
|
24223
|
+
const [showFormErrors, setShowFormErrors] = (0, import_react75.useState)(false);
|
|
24148
24224
|
const formData = usePolicyForm();
|
|
24149
24225
|
const formState = usePolicyFormValidation();
|
|
24150
|
-
(0,
|
|
24226
|
+
(0, import_react75.useEffect)(() => {
|
|
24151
24227
|
if (!formData) return;
|
|
24152
24228
|
setShowFormErrors(false);
|
|
24153
24229
|
const errors = {};
|
|
@@ -24174,7 +24250,7 @@ function useWatchFormData() {
|
|
|
24174
24250
|
}
|
|
24175
24251
|
usePolicyFormValidation.setState(errors, true);
|
|
24176
24252
|
}, [formData]);
|
|
24177
|
-
(0,
|
|
24253
|
+
(0, import_react75.useEffect)(() => () => usePolicyFormValidation.setState({}, true), []);
|
|
24178
24254
|
const formErrorItem = Object.entries(formState).find(([_, value]) => value?.error);
|
|
24179
24255
|
const formErrorMessage = formErrorItem ? `${formErrorItem[0].toUpperCase()}: ${formErrorItem[1]?.error}` : "";
|
|
24180
24256
|
return {
|
|
@@ -24185,10 +24261,10 @@ function useWatchFormData() {
|
|
|
24185
24261
|
setShowFormErrors
|
|
24186
24262
|
};
|
|
24187
24263
|
}
|
|
24188
|
-
var
|
|
24264
|
+
var import_react75, import_zustand14, usePolicyForm, usePolicyFormValidation;
|
|
24189
24265
|
var init_usePolicyForm = __esm({
|
|
24190
24266
|
"src/internal/components/SecurityMenu/UserPolicies/usePolicyForm.ts"() {
|
|
24191
|
-
|
|
24267
|
+
import_react75 = require("react");
|
|
24192
24268
|
import_zustand14 = require("zustand");
|
|
24193
24269
|
init_utils10();
|
|
24194
24270
|
usePolicyForm = (0, import_zustand14.create)(() => null);
|
|
@@ -24219,10 +24295,10 @@ var init_useUserAssetsPolicies = __esm({
|
|
|
24219
24295
|
// src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx
|
|
24220
24296
|
function AddressListEditor(props) {
|
|
24221
24297
|
const { label, assets = [], addresses, onChange } = props;
|
|
24222
|
-
const [isAssetSelector, setIsAssetSelector] = (0,
|
|
24223
|
-
const [customAddress, setCustomAddress] = (0,
|
|
24224
|
-
const [customAddressError, setCustomAddressError] = (0,
|
|
24225
|
-
const handleAddress = (0,
|
|
24298
|
+
const [isAssetSelector, setIsAssetSelector] = (0, import_react76.useState)(false);
|
|
24299
|
+
const [customAddress, setCustomAddress] = (0, import_react76.useState)("");
|
|
24300
|
+
const [customAddressError, setCustomAddressError] = (0, import_react76.useState)(null);
|
|
24301
|
+
const handleAddress = (0, import_react76.useCallback)(
|
|
24226
24302
|
(addressToAdd) => {
|
|
24227
24303
|
if (!isValidAddress(addressToAdd)) {
|
|
24228
24304
|
setCustomAddressError("Bad address");
|
|
@@ -24449,14 +24525,14 @@ function PolicyForm() {
|
|
|
24449
24525
|
showFormErrors && formErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Highlight, { type: "error", children: formErrorMessage })
|
|
24450
24526
|
] });
|
|
24451
24527
|
}
|
|
24452
|
-
var import_react_query47, import_lucide_react63,
|
|
24528
|
+
var import_react_query47, import_lucide_react63, import_react76, import_jsx_runtime106;
|
|
24453
24529
|
var init_PolicyForm = __esm({
|
|
24454
24530
|
"src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx"() {
|
|
24455
24531
|
init_SessionContext();
|
|
24456
24532
|
init_useT();
|
|
24457
24533
|
import_react_query47 = require("@tanstack/react-query");
|
|
24458
24534
|
import_lucide_react63 = require("lucide-react");
|
|
24459
|
-
|
|
24535
|
+
import_react76 = require("react");
|
|
24460
24536
|
init_button();
|
|
24461
24537
|
init_highlight();
|
|
24462
24538
|
init_input();
|
|
@@ -24538,7 +24614,7 @@ function UserPolicies() {
|
|
|
24538
24614
|
const config = useProviderConfig().config;
|
|
24539
24615
|
const mpcUserId = useSession((st) => st.session?.mpcUserId);
|
|
24540
24616
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
24541
|
-
const [isConfirmingDelete, setIsConfirmingDelete] = (0,
|
|
24617
|
+
const [isConfirmingDelete, setIsConfirmingDelete] = (0, import_react77.useState)(false);
|
|
24542
24618
|
const { data: policyView, isLoading: isPolicyLoading } = useUserAssetsPolicies(activeChainId);
|
|
24543
24619
|
const { mutate: cancelPending, isPending: isCancellingPending } = (0, import_react_query48.useMutation)({
|
|
24544
24620
|
mutationFn: async () => {
|
|
@@ -24651,7 +24727,7 @@ function UserPolicies() {
|
|
|
24651
24727
|
] })
|
|
24652
24728
|
] });
|
|
24653
24729
|
}
|
|
24654
|
-
var import_react_query48, import_clsx3, import_lucide_react64,
|
|
24730
|
+
var import_react_query48, import_clsx3, import_lucide_react64, import_react77, import_jsx_runtime107;
|
|
24655
24731
|
var init_UserPolicies = __esm({
|
|
24656
24732
|
"src/internal/components/SecurityMenu/UserPolicies/UserPolicies.tsx"() {
|
|
24657
24733
|
init_ProviderContext();
|
|
@@ -24660,7 +24736,7 @@ var init_UserPolicies = __esm({
|
|
|
24660
24736
|
import_react_query48 = require("@tanstack/react-query");
|
|
24661
24737
|
import_clsx3 = __toESM(require("clsx"), 1);
|
|
24662
24738
|
import_lucide_react64 = require("lucide-react");
|
|
24663
|
-
|
|
24739
|
+
import_react77 = require("react");
|
|
24664
24740
|
init_button();
|
|
24665
24741
|
init_highlight();
|
|
24666
24742
|
init_api4();
|
|
@@ -24685,7 +24761,7 @@ var init_UserPolicies2 = __esm({
|
|
|
24685
24761
|
|
|
24686
24762
|
// src/internal/components/SecurityMenu/useSecurityMenuParams.ts
|
|
24687
24763
|
function useSecurityMenuParams() {
|
|
24688
|
-
(0,
|
|
24764
|
+
(0, import_react78.useEffect)(() => {
|
|
24689
24765
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
24690
24766
|
if (!pageParams || !(0, import_lodash_es15.keys)(pageParams).length) return;
|
|
24691
24767
|
const { submenu } = pageParams;
|
|
@@ -24709,11 +24785,11 @@ function useSecurityMenuParams() {
|
|
|
24709
24785
|
setPageParams(null);
|
|
24710
24786
|
}, []);
|
|
24711
24787
|
}
|
|
24712
|
-
var import_lodash_es15,
|
|
24788
|
+
var import_lodash_es15, import_react78;
|
|
24713
24789
|
var init_useSecurityMenuParams = __esm({
|
|
24714
24790
|
"src/internal/components/SecurityMenu/useSecurityMenuParams.ts"() {
|
|
24715
24791
|
import_lodash_es15 = require("lodash-es");
|
|
24716
|
-
|
|
24792
|
+
import_react78 = require("react");
|
|
24717
24793
|
init_useLayoutDataStore();
|
|
24718
24794
|
init_UserPolicies2();
|
|
24719
24795
|
init_useSecurityStore();
|
|
@@ -24728,7 +24804,7 @@ function SecurityMenuContent() {
|
|
|
24728
24804
|
const { appToUntrust, showConnectedApps, showAssetsPolicies } = useSecurityStore();
|
|
24729
24805
|
const policyForm = usePolicyForm();
|
|
24730
24806
|
useOnboardingTourAvailable(!showConnectedApps && !showAssetsPolicies);
|
|
24731
|
-
(0,
|
|
24807
|
+
(0, import_react79.useEffect)(() => {
|
|
24732
24808
|
let securityTitle = "";
|
|
24733
24809
|
switch (true) {
|
|
24734
24810
|
case showConnectedApps:
|
|
@@ -24749,7 +24825,7 @@ function SecurityMenuContent() {
|
|
|
24749
24825
|
return () => {
|
|
24750
24826
|
};
|
|
24751
24827
|
}, [t, showConnectedApps, showAssetsPolicies, policyForm]);
|
|
24752
|
-
(0,
|
|
24828
|
+
(0, import_react79.useEffect)(
|
|
24753
24829
|
() => () => {
|
|
24754
24830
|
usePolicyForm.setState(null, true);
|
|
24755
24831
|
useSecurityStore.setState(
|
|
@@ -24843,13 +24919,13 @@ function SecurityMenu() {
|
|
|
24843
24919
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SecurityMenuContent, {})
|
|
24844
24920
|
] });
|
|
24845
24921
|
}
|
|
24846
|
-
var import_lucide_react65,
|
|
24922
|
+
var import_lucide_react65, import_react79, import_jsx_runtime108;
|
|
24847
24923
|
var init_SecurityMenu = __esm({
|
|
24848
24924
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
24849
24925
|
init_ProviderContext();
|
|
24850
24926
|
init_i18n();
|
|
24851
24927
|
import_lucide_react65 = require("lucide-react");
|
|
24852
|
-
|
|
24928
|
+
import_react79 = require("react");
|
|
24853
24929
|
init_useLayoutDataStore();
|
|
24854
24930
|
init_Expandable2();
|
|
24855
24931
|
init_Onboarding();
|
|
@@ -25053,8 +25129,8 @@ var init_SenderSelector = __esm({
|
|
|
25053
25129
|
function useAvailableSenders() {
|
|
25054
25130
|
const address = useSession((st) => st.address);
|
|
25055
25131
|
const { profiles } = useLinkedProfiles();
|
|
25056
|
-
const lastCalcedSenders = (0,
|
|
25057
|
-
(0,
|
|
25132
|
+
const lastCalcedSenders = (0, import_react80.useRef)([]);
|
|
25133
|
+
(0, import_react80.useEffect)(() => {
|
|
25058
25134
|
const sendersAccumulator = [
|
|
25059
25135
|
{
|
|
25060
25136
|
type: "embarkai-wallet",
|
|
@@ -25088,13 +25164,13 @@ function useAvailableSenders() {
|
|
|
25088
25164
|
directWalletProfiles: profiles.filter((p) => p.provider === "wallet")
|
|
25089
25165
|
};
|
|
25090
25166
|
}
|
|
25091
|
-
var
|
|
25167
|
+
var import_react80;
|
|
25092
25168
|
var init_useAvailableSenders = __esm({
|
|
25093
25169
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
25094
25170
|
init_SessionContext();
|
|
25095
25171
|
init_tokens();
|
|
25096
25172
|
init_linkedProfiles();
|
|
25097
|
-
|
|
25173
|
+
import_react80 = require("react");
|
|
25098
25174
|
init_wallets();
|
|
25099
25175
|
init_useBridgeStore();
|
|
25100
25176
|
}
|
|
@@ -25509,18 +25585,18 @@ function useHyperlaneHistory() {
|
|
|
25509
25585
|
getNextPageParam: (lastPage) => lastPage.page < lastPage.pageCount ? lastPage.page + 1 : void 0,
|
|
25510
25586
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
25511
25587
|
});
|
|
25512
|
-
const txList = (0,
|
|
25588
|
+
const txList = (0, import_react81.useMemo)(
|
|
25513
25589
|
() => query?.data?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
25514
25590
|
[query?.data]
|
|
25515
25591
|
);
|
|
25516
25592
|
return { query, txList };
|
|
25517
25593
|
}
|
|
25518
|
-
var import_react_query49,
|
|
25594
|
+
var import_react_query49, import_react81, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
25519
25595
|
var init_useHyperlaneHistory = __esm({
|
|
25520
25596
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
25521
25597
|
init_SessionContext();
|
|
25522
25598
|
import_react_query49 = require("@tanstack/react-query");
|
|
25523
|
-
|
|
25599
|
+
import_react81 = require("react");
|
|
25524
25600
|
init_useLayoutDataStore();
|
|
25525
25601
|
init_useFlowSelector();
|
|
25526
25602
|
init_api5();
|
|
@@ -25550,9 +25626,9 @@ function useBridge() {
|
|
|
25550
25626
|
const qc = (0, import_react_query50.useQueryClient)();
|
|
25551
25627
|
const { t } = useT();
|
|
25552
25628
|
const address = useSession((st) => st.address);
|
|
25553
|
-
const { data: walletClient } = (0,
|
|
25554
|
-
const { mutateAsync: switchChainAsync } = (0,
|
|
25555
|
-
const swapDirection = (0,
|
|
25629
|
+
const { data: walletClient } = (0, import_wagmi5.useWalletClient)();
|
|
25630
|
+
const { mutateAsync: switchChainAsync } = (0, import_wagmi5.useSwitchChain)();
|
|
25631
|
+
const swapDirection = (0, import_react82.useCallback)(() => {
|
|
25556
25632
|
const {
|
|
25557
25633
|
// bridgeStep,
|
|
25558
25634
|
originChain,
|
|
@@ -25603,7 +25679,7 @@ function useBridge() {
|
|
|
25603
25679
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
25604
25680
|
}
|
|
25605
25681
|
});
|
|
25606
|
-
const handleQuoteEstimation = (0,
|
|
25682
|
+
const handleQuoteEstimation = (0, import_react82.useCallback)((amnt) => {
|
|
25607
25683
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
25608
25684
|
if (!amnt || !Number(amnt)) {
|
|
25609
25685
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -25738,14 +25814,14 @@ function useBridge() {
|
|
|
25738
25814
|
isAssetBridging
|
|
25739
25815
|
};
|
|
25740
25816
|
}
|
|
25741
|
-
var import_react_query50,
|
|
25817
|
+
var import_react_query50, import_react82, import_wagmi5;
|
|
25742
25818
|
var init_useBridge = __esm({
|
|
25743
25819
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
25744
25820
|
init_SessionContext();
|
|
25745
25821
|
init_i18n();
|
|
25746
25822
|
import_react_query50 = require("@tanstack/react-query");
|
|
25747
|
-
|
|
25748
|
-
|
|
25823
|
+
import_react82 = require("react");
|
|
25824
|
+
import_wagmi5 = require("wagmi");
|
|
25749
25825
|
init_useLayoutStore();
|
|
25750
25826
|
init_useExternalWalletStore();
|
|
25751
25827
|
init_useFlowSelector();
|
|
@@ -25775,7 +25851,7 @@ function useHyperlaneRoutes() {
|
|
|
25775
25851
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
25776
25852
|
queryFn: async () => await getHyperlaneWarpRoutes()
|
|
25777
25853
|
});
|
|
25778
|
-
(0,
|
|
25854
|
+
(0, import_react83.useEffect)(() => {
|
|
25779
25855
|
if (!errorWarpRoutes) return;
|
|
25780
25856
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
25781
25857
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -25784,7 +25860,7 @@ function useHyperlaneRoutes() {
|
|
|
25784
25860
|
setOriginChain(null);
|
|
25785
25861
|
setDestinationChain(null);
|
|
25786
25862
|
}, [errorWarpRoutes]);
|
|
25787
|
-
(0,
|
|
25863
|
+
(0, import_react83.useEffect)(() => {
|
|
25788
25864
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
25789
25865
|
let targetHyperRouteToSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
25790
25866
|
if (!targetHyperRouteToSelect) {
|
|
@@ -25809,12 +25885,12 @@ function useHyperlaneRoutes() {
|
|
|
25809
25885
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
25810
25886
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
25811
25887
|
}
|
|
25812
|
-
var import_react_query51,
|
|
25888
|
+
var import_react_query51, import_react83, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
25813
25889
|
var init_useHyperlaneRoutes = __esm({
|
|
25814
25890
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
25815
25891
|
init_SessionContext();
|
|
25816
25892
|
import_react_query51 = require("@tanstack/react-query");
|
|
25817
|
-
|
|
25893
|
+
import_react83 = require("react");
|
|
25818
25894
|
init_useLayoutDataStore();
|
|
25819
25895
|
init_useFlowSelector();
|
|
25820
25896
|
init_api5();
|
|
@@ -25830,7 +25906,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
25830
25906
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
25831
25907
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
25832
25908
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
25833
|
-
(0,
|
|
25909
|
+
(0, import_react84.useEffect)(() => {
|
|
25834
25910
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
25835
25911
|
switch (true) {
|
|
25836
25912
|
case bridgeStep === "sender-selector":
|
|
@@ -25858,11 +25934,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
25858
25934
|
}
|
|
25859
25935
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
25860
25936
|
}
|
|
25861
|
-
var
|
|
25937
|
+
var import_react84;
|
|
25862
25938
|
var init_useMenuTitle = __esm({
|
|
25863
25939
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
25864
25940
|
init_i18n();
|
|
25865
|
-
|
|
25941
|
+
import_react84 = require("react");
|
|
25866
25942
|
init_useFlowSelector();
|
|
25867
25943
|
init_useBridgeStore();
|
|
25868
25944
|
}
|
|
@@ -26032,7 +26108,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26032
26108
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
26033
26109
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
26034
26110
|
const directWalletChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
26035
|
-
const { mutateAsync: switchChainAsync } = (0,
|
|
26111
|
+
const { mutateAsync: switchChainAsync } = (0, import_wagmi6.useSwitchChain)();
|
|
26036
26112
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
26037
26113
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
26038
26114
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
@@ -26112,7 +26188,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26112
26188
|
};
|
|
26113
26189
|
}
|
|
26114
26190
|
});
|
|
26115
|
-
const refreshRouteTokenBalance = (0,
|
|
26191
|
+
const refreshRouteTokenBalance = (0, import_react85.useCallback)(
|
|
26116
26192
|
(senderWallet) => {
|
|
26117
26193
|
switch (true) {
|
|
26118
26194
|
case senderWallet === "embarkai-wallet":
|
|
@@ -26128,7 +26204,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26128
26204
|
},
|
|
26129
26205
|
[refreshBalances, qc]
|
|
26130
26206
|
);
|
|
26131
|
-
(0,
|
|
26207
|
+
(0, import_react85.useEffect)(() => {
|
|
26132
26208
|
if (!!isLoadingWarpRoutes || !bridgeSender || !originChain) return;
|
|
26133
26209
|
switch (bridgeSender) {
|
|
26134
26210
|
case "embarkai-wallet":
|
|
@@ -26159,16 +26235,16 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26159
26235
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
26160
26236
|
};
|
|
26161
26237
|
}
|
|
26162
|
-
var import_core8, import_react_query52,
|
|
26238
|
+
var import_core8, import_react_query52, import_react85, import_viem15, import_wagmi6, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
26163
26239
|
var init_useBridgeBalance = __esm({
|
|
26164
26240
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
26165
26241
|
init_SessionContext();
|
|
26166
26242
|
init_i18n();
|
|
26167
26243
|
import_core8 = require("@embarkai/core");
|
|
26168
26244
|
import_react_query52 = require("@tanstack/react-query");
|
|
26169
|
-
|
|
26245
|
+
import_react85 = require("react");
|
|
26170
26246
|
import_viem15 = require("viem");
|
|
26171
|
-
|
|
26247
|
+
import_wagmi6 = require("wagmi");
|
|
26172
26248
|
init_useBlockscoutAssets2();
|
|
26173
26249
|
init_useExternalWalletStore();
|
|
26174
26250
|
init_BalanceFeedProvider2();
|
|
@@ -26295,7 +26371,7 @@ function SelectStep(props) {
|
|
|
26295
26371
|
variant: "outline",
|
|
26296
26372
|
size: "medium",
|
|
26297
26373
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
26298
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
26374
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_react86.Fragment, { children: [
|
|
26299
26375
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_lucide_react67.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
26300
26376
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
26301
26377
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -26439,13 +26515,13 @@ function SelectStep(props) {
|
|
|
26439
26515
|
)
|
|
26440
26516
|
] });
|
|
26441
26517
|
}
|
|
26442
|
-
var import_lucide_react67,
|
|
26518
|
+
var import_lucide_react67, import_react86, import_jsx_runtime111;
|
|
26443
26519
|
var init_SelectStep = __esm({
|
|
26444
26520
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
26445
26521
|
init_tokens();
|
|
26446
26522
|
init_i18n();
|
|
26447
26523
|
import_lucide_react67 = require("lucide-react");
|
|
26448
|
-
|
|
26524
|
+
import_react86 = require("react");
|
|
26449
26525
|
init_priceFormatter();
|
|
26450
26526
|
init_utils();
|
|
26451
26527
|
init_useExternalWalletStore();
|
|
@@ -26496,7 +26572,7 @@ var init_checkbox = __esm({
|
|
|
26496
26572
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
26497
26573
|
function ConfirmStep(props) {
|
|
26498
26574
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
26499
|
-
const [userConsent, setUserConsent] = (0,
|
|
26575
|
+
const [userConsent, setUserConsent] = (0, import_react87.useState)(false);
|
|
26500
26576
|
const { t } = useT();
|
|
26501
26577
|
const address = useSession((st) => st.address);
|
|
26502
26578
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -26612,13 +26688,13 @@ function ConfirmStep(props) {
|
|
|
26612
26688
|
}
|
|
26613
26689
|
);
|
|
26614
26690
|
}
|
|
26615
|
-
var import_lucide_react69,
|
|
26691
|
+
var import_lucide_react69, import_react87, import_jsx_runtime113, P_CN;
|
|
26616
26692
|
var init_ConfirmStep = __esm({
|
|
26617
26693
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
26618
26694
|
init_SessionContext();
|
|
26619
26695
|
init_i18n();
|
|
26620
26696
|
import_lucide_react69 = require("lucide-react");
|
|
26621
|
-
|
|
26697
|
+
import_react87 = require("react");
|
|
26622
26698
|
init_priceFormatter();
|
|
26623
26699
|
init_utils();
|
|
26624
26700
|
init_Onboarding();
|
|
@@ -26995,7 +27071,7 @@ function SelectAssetRoute(props) {
|
|
|
26995
27071
|
const { hyperlaneWarpRoutes } = props;
|
|
26996
27072
|
const { t } = useT();
|
|
26997
27073
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
26998
|
-
const tokenList = (0,
|
|
27074
|
+
const tokenList = (0, import_react88.useMemo)(() => {
|
|
26999
27075
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
27000
27076
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
27001
27077
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -27072,13 +27148,13 @@ function SelectAssetRoute(props) {
|
|
|
27072
27148
|
] })
|
|
27073
27149
|
] });
|
|
27074
27150
|
}
|
|
27075
|
-
var import_lucide_react71,
|
|
27151
|
+
var import_lucide_react71, import_react88, import_jsx_runtime116;
|
|
27076
27152
|
var init_SelectAssetRoute = __esm({
|
|
27077
27153
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
27078
27154
|
init_tokens();
|
|
27079
27155
|
init_i18n();
|
|
27080
27156
|
import_lucide_react71 = require("lucide-react");
|
|
27081
|
-
|
|
27157
|
+
import_react88 = require("react");
|
|
27082
27158
|
init_button();
|
|
27083
27159
|
init_ResolveChainIcon();
|
|
27084
27160
|
init_useBridgeStore();
|
|
@@ -27105,7 +27181,7 @@ function HyperlaneBridge() {
|
|
|
27105
27181
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
27106
27182
|
const { directWalletProfiles } = useAvailableSenders();
|
|
27107
27183
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
27108
|
-
(0,
|
|
27184
|
+
(0, import_react89.useEffect)(() => {
|
|
27109
27185
|
return () => {
|
|
27110
27186
|
useBridgeStore.getState().resetSelections();
|
|
27111
27187
|
};
|
|
@@ -27138,10 +27214,10 @@ function HyperlaneBridge() {
|
|
|
27138
27214
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(HistoryDetailsStep, {})
|
|
27139
27215
|
] });
|
|
27140
27216
|
}
|
|
27141
|
-
var
|
|
27217
|
+
var import_react89, import_jsx_runtime117;
|
|
27142
27218
|
var init_HyperlaneBridge = __esm({
|
|
27143
27219
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
27144
|
-
|
|
27220
|
+
import_react89 = require("react");
|
|
27145
27221
|
init_SenderSelector();
|
|
27146
27222
|
init_useAvailableSenders();
|
|
27147
27223
|
init_useBridge();
|
|
@@ -27159,7 +27235,7 @@ function BridgeHistorySwitch(props) {
|
|
|
27159
27235
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
27160
27236
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
27161
27237
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
27162
|
-
const lastBridgeStepRef = (0,
|
|
27238
|
+
const lastBridgeStepRef = (0, import_react90.useRef)(null);
|
|
27163
27239
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
27164
27240
|
return null;
|
|
27165
27241
|
}
|
|
@@ -27178,10 +27254,10 @@ function BridgeHistorySwitch(props) {
|
|
|
27178
27254
|
}
|
|
27179
27255
|
);
|
|
27180
27256
|
}
|
|
27181
|
-
var
|
|
27257
|
+
var import_react90, import_jsx_runtime118;
|
|
27182
27258
|
var init_HistorySwitch = __esm({
|
|
27183
27259
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
27184
|
-
|
|
27260
|
+
import_react90 = require("react");
|
|
27185
27261
|
init_switch();
|
|
27186
27262
|
init_useFlowSelector();
|
|
27187
27263
|
init_useBridgeStore();
|
|
@@ -27207,7 +27283,7 @@ function useErc3643Compliance(options) {
|
|
|
27207
27283
|
isLoading,
|
|
27208
27284
|
error: queryError,
|
|
27209
27285
|
refetch
|
|
27210
|
-
} = (0,
|
|
27286
|
+
} = (0, import_wagmi7.useReadContract)({
|
|
27211
27287
|
address: tokenAddress,
|
|
27212
27288
|
abi: ERC3643_CAN_TRANSFER_ABI,
|
|
27213
27289
|
functionName: "canTransfer",
|
|
@@ -27244,10 +27320,10 @@ function useErc3643Compliance(options) {
|
|
|
27244
27320
|
refetch
|
|
27245
27321
|
};
|
|
27246
27322
|
}
|
|
27247
|
-
var
|
|
27323
|
+
var import_wagmi7, ERC3643_CAN_TRANSFER_ABI;
|
|
27248
27324
|
var init_useErc3643Compliance = __esm({
|
|
27249
27325
|
"src/hooks/useErc3643Compliance.ts"() {
|
|
27250
|
-
|
|
27326
|
+
import_wagmi7 = require("wagmi");
|
|
27251
27327
|
ERC3643_CAN_TRANSFER_ABI = [
|
|
27252
27328
|
{
|
|
27253
27329
|
type: "function",
|
|
@@ -27272,11 +27348,11 @@ function looksLikeNickname(input) {
|
|
|
27272
27348
|
}
|
|
27273
27349
|
function useNicknameResolve(input, options) {
|
|
27274
27350
|
const { enabled = true, chainId } = options;
|
|
27275
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
27276
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
27351
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react91.useState)("");
|
|
27352
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react91.useState)(false);
|
|
27277
27353
|
const normalized = normalizeNickname(input);
|
|
27278
27354
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
27279
|
-
(0,
|
|
27355
|
+
(0, import_react91.useEffect)(() => {
|
|
27280
27356
|
if (!isNicknameInput || !enabled) {
|
|
27281
27357
|
setDebouncedInput("");
|
|
27282
27358
|
setIsDebouncing(false);
|
|
@@ -27302,7 +27378,7 @@ function useNicknameResolve(input, options) {
|
|
|
27302
27378
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
27303
27379
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
27304
27380
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
27305
|
-
const fingerprintVerification = (0,
|
|
27381
|
+
const fingerprintVerification = (0, import_react91.useMemo)(() => {
|
|
27306
27382
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
27307
27383
|
return null;
|
|
27308
27384
|
}
|
|
@@ -27324,11 +27400,11 @@ function useNicknameResolve(input, options) {
|
|
|
27324
27400
|
resolvedAddress
|
|
27325
27401
|
};
|
|
27326
27402
|
}
|
|
27327
|
-
var import_react_query54,
|
|
27403
|
+
var import_react_query54, import_react91, DEBOUNCE_MS2;
|
|
27328
27404
|
var init_useNicknameResolve = __esm({
|
|
27329
27405
|
"src/hooks/useNicknameResolve.ts"() {
|
|
27330
27406
|
import_react_query54 = require("@tanstack/react-query");
|
|
27331
|
-
|
|
27407
|
+
import_react91 = require("react");
|
|
27332
27408
|
init_nickname();
|
|
27333
27409
|
init_profile();
|
|
27334
27410
|
init_nickname_fingerprint();
|
|
@@ -27341,10 +27417,10 @@ var init_useNicknameResolve = __esm({
|
|
|
27341
27417
|
function useSendTransaction() {
|
|
27342
27418
|
const session = useSession((st) => st.session);
|
|
27343
27419
|
const address = useSession((st) => st.address);
|
|
27344
|
-
const [isLoading, setIsLoading] = (0,
|
|
27345
|
-
const [error, setError] = (0,
|
|
27346
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
27347
|
-
const sendTransaction = (0,
|
|
27420
|
+
const [isLoading, setIsLoading] = (0, import_react92.useState)(false);
|
|
27421
|
+
const [error, setError] = (0, import_react92.useState)(null);
|
|
27422
|
+
const [userOpHash, setUserOpHash] = (0, import_react92.useState)(null);
|
|
27423
|
+
const sendTransaction = (0, import_react92.useCallback)(
|
|
27348
27424
|
async (params) => {
|
|
27349
27425
|
if (!session || !address) {
|
|
27350
27426
|
setError("No active session");
|
|
@@ -27441,7 +27517,7 @@ function useSendTransaction() {
|
|
|
27441
27517
|
},
|
|
27442
27518
|
[session, address]
|
|
27443
27519
|
);
|
|
27444
|
-
const reset = (0,
|
|
27520
|
+
const reset = (0, import_react92.useCallback)(() => {
|
|
27445
27521
|
setError(null);
|
|
27446
27522
|
setUserOpHash(null);
|
|
27447
27523
|
setIsLoading(false);
|
|
@@ -27454,10 +27530,10 @@ function useSendTransaction() {
|
|
|
27454
27530
|
reset
|
|
27455
27531
|
};
|
|
27456
27532
|
}
|
|
27457
|
-
var
|
|
27533
|
+
var import_react92, import_viem16, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
27458
27534
|
var init_useSendTransaction = __esm({
|
|
27459
27535
|
"src/hooks/useSendTransaction.ts"() {
|
|
27460
|
-
|
|
27536
|
+
import_react92 = require("react");
|
|
27461
27537
|
import_viem16 = require("viem");
|
|
27462
27538
|
init_SessionContext();
|
|
27463
27539
|
init_account2();
|
|
@@ -27608,7 +27684,7 @@ var init_AssetInputIcon = __esm({
|
|
|
27608
27684
|
|
|
27609
27685
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
27610
27686
|
function NftDisplayCard({ asset }) {
|
|
27611
|
-
const [imageError, setImageError] = (0,
|
|
27687
|
+
const [imageError, setImageError] = (0, import_react93.useState)(false);
|
|
27612
27688
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
27613
27689
|
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
27614
27690
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
@@ -27636,11 +27712,11 @@ function NftDisplayCard({ asset }) {
|
|
|
27636
27712
|
] })
|
|
27637
27713
|
] });
|
|
27638
27714
|
}
|
|
27639
|
-
var import_lucide_react73,
|
|
27715
|
+
var import_lucide_react73, import_react93, import_jsx_runtime120;
|
|
27640
27716
|
var init_NftDisplayCard = __esm({
|
|
27641
27717
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
27642
27718
|
import_lucide_react73 = require("lucide-react");
|
|
27643
|
-
|
|
27719
|
+
import_react93 = require("react");
|
|
27644
27720
|
import_jsx_runtime120 = require("react/jsx-runtime");
|
|
27645
27721
|
}
|
|
27646
27722
|
});
|
|
@@ -27760,7 +27836,7 @@ function NicknameData(props) {
|
|
|
27760
27836
|
isWalletNotSetup,
|
|
27761
27837
|
isFrozen
|
|
27762
27838
|
} = resolvedNicknameData;
|
|
27763
|
-
(0,
|
|
27839
|
+
(0, import_react94.useEffect)(() => {
|
|
27764
27840
|
if (isResolving) return;
|
|
27765
27841
|
let errMessage = null;
|
|
27766
27842
|
switch (true) {
|
|
@@ -27815,11 +27891,11 @@ function NicknameData(props) {
|
|
|
27815
27891
|
] })
|
|
27816
27892
|
] });
|
|
27817
27893
|
}
|
|
27818
|
-
var import_lucide_react74,
|
|
27894
|
+
var import_lucide_react74, import_react94, import_jsx_runtime122;
|
|
27819
27895
|
var init_NicknameData = __esm({
|
|
27820
27896
|
"src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
|
|
27821
27897
|
import_lucide_react74 = require("lucide-react");
|
|
27822
|
-
|
|
27898
|
+
import_react94 = require("react");
|
|
27823
27899
|
init_no_image();
|
|
27824
27900
|
init_utils();
|
|
27825
27901
|
init_useFlowSelector();
|
|
@@ -28352,16 +28428,16 @@ function SendMenu() {
|
|
|
28352
28428
|
userOpHash,
|
|
28353
28429
|
reset
|
|
28354
28430
|
} = useSendTransaction();
|
|
28355
|
-
(0,
|
|
28431
|
+
(0, import_react95.useEffect)(() => {
|
|
28356
28432
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
28357
28433
|
}, [isAssetsLoading, isTransactionPending]);
|
|
28358
|
-
(0,
|
|
28434
|
+
(0, import_react95.useEffect)(() => {
|
|
28359
28435
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
28360
28436
|
}, [sendTransactionError]);
|
|
28361
28437
|
const { txStep, recipient, amount, selectedAsset, setSelectedAsset } = useSendStore();
|
|
28362
28438
|
const isNft = isNftAsset3(selectedAsset);
|
|
28363
28439
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
28364
|
-
(0,
|
|
28440
|
+
(0, import_react95.useEffect)(() => {
|
|
28365
28441
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
28366
28442
|
if (!shouldDefaultAsset) return;
|
|
28367
28443
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -28371,7 +28447,7 @@ function SendMenu() {
|
|
|
28371
28447
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
28372
28448
|
setSelectedAsset(assets[0]);
|
|
28373
28449
|
}, [assets, selectedAsset]);
|
|
28374
|
-
(0,
|
|
28450
|
+
(0, import_react95.useEffect)(
|
|
28375
28451
|
() => () => {
|
|
28376
28452
|
useSendStore.getState().reset();
|
|
28377
28453
|
reset();
|
|
@@ -28381,7 +28457,7 @@ function SendMenu() {
|
|
|
28381
28457
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
28382
28458
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
28383
28459
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
28384
|
-
const complianceAmount = (0,
|
|
28460
|
+
const complianceAmount = (0, import_react95.useMemo)(() => {
|
|
28385
28461
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
28386
28462
|
try {
|
|
28387
28463
|
return (0, import_viem21.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -28396,7 +28472,7 @@ function SendMenu() {
|
|
|
28396
28472
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
28397
28473
|
chainId: activeChainId
|
|
28398
28474
|
});
|
|
28399
|
-
(0,
|
|
28475
|
+
(0, import_react95.useEffect)(() => {
|
|
28400
28476
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
28401
28477
|
switch (true) {
|
|
28402
28478
|
case txStep === "select-asset":
|
|
@@ -28466,7 +28542,7 @@ function SendMenu() {
|
|
|
28466
28542
|
] })
|
|
28467
28543
|
] });
|
|
28468
28544
|
}
|
|
28469
|
-
var import_lucide_react77,
|
|
28545
|
+
var import_lucide_react77, import_react95, import_viem21, import_jsx_runtime125;
|
|
28470
28546
|
var init_SendMenu = __esm({
|
|
28471
28547
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
28472
28548
|
init_SessionContext();
|
|
@@ -28475,7 +28551,7 @@ var init_SendMenu = __esm({
|
|
|
28475
28551
|
init_useSendTransaction();
|
|
28476
28552
|
init_useT();
|
|
28477
28553
|
import_lucide_react77 = require("lucide-react");
|
|
28478
|
-
|
|
28554
|
+
import_react95 = require("react");
|
|
28479
28555
|
import_viem21 = require("viem");
|
|
28480
28556
|
init_useBlockscoutAssets2();
|
|
28481
28557
|
init_useLayoutDataStore();
|
|
@@ -28501,7 +28577,7 @@ var init_send = __esm({
|
|
|
28501
28577
|
// src/internal/components/SendMenu/useSendMenuParams.ts
|
|
28502
28578
|
function useSendMenuParams() {
|
|
28503
28579
|
const { config } = useProviderConfig();
|
|
28504
|
-
(0,
|
|
28580
|
+
(0, import_react96.useEffect)(() => {
|
|
28505
28581
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
28506
28582
|
if (!pageParams || !(0, import_lodash_es16.keys)(pageParams).length) return;
|
|
28507
28583
|
const { sendFlow, send, bridge } = pageParams || {};
|
|
@@ -28554,12 +28630,12 @@ function useSendMenuParams() {
|
|
|
28554
28630
|
setPageParams(null);
|
|
28555
28631
|
}, []);
|
|
28556
28632
|
}
|
|
28557
|
-
var import_lodash_es16,
|
|
28633
|
+
var import_lodash_es16, import_react96;
|
|
28558
28634
|
var init_useSendMenuParams = __esm({
|
|
28559
28635
|
"src/internal/components/SendMenu/useSendMenuParams.ts"() {
|
|
28560
28636
|
init_ProviderContext();
|
|
28561
28637
|
import_lodash_es16 = require("lodash-es");
|
|
28562
|
-
|
|
28638
|
+
import_react96 = require("react");
|
|
28563
28639
|
init_useLayoutDataStore();
|
|
28564
28640
|
init_useBridgeStore();
|
|
28565
28641
|
init_useSendStore();
|
|
@@ -28627,17 +28703,17 @@ function SendFlowSelector() {
|
|
|
28627
28703
|
const sendStep = useSendStore((st) => st.txStep);
|
|
28628
28704
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
28629
28705
|
useOnboardingTourAvailable(sendStep === "input" && bridgeStep === "select");
|
|
28630
|
-
(0,
|
|
28706
|
+
(0, import_react97.useEffect)(
|
|
28631
28707
|
() => () => {
|
|
28632
28708
|
useFlowSelectorStore.getState().setError(null);
|
|
28633
28709
|
},
|
|
28634
28710
|
[]
|
|
28635
28711
|
);
|
|
28636
|
-
(0,
|
|
28712
|
+
(0, import_react97.useEffect)(() => {
|
|
28637
28713
|
if (!!config?.current?.features?.showAssetBridge) return;
|
|
28638
28714
|
if (selectorFlow === "bridge") useFlowSelectorStore.getState().setFlow("send");
|
|
28639
28715
|
}, [selectorFlow]);
|
|
28640
|
-
const availableFlows = (0,
|
|
28716
|
+
const availableFlows = (0, import_react97.useMemo)(() => {
|
|
28641
28717
|
const selectorFlows = { send: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SendMenu, {}) };
|
|
28642
28718
|
if (!!config?.current?.features?.showAssetBridge) selectorFlows.bridge = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(HyperlaneBridge, {});
|
|
28643
28719
|
return selectorFlows;
|
|
@@ -28702,13 +28778,13 @@ function SendFlowSelector() {
|
|
|
28702
28778
|
] })
|
|
28703
28779
|
] });
|
|
28704
28780
|
}
|
|
28705
|
-
var import_lucide_react78,
|
|
28781
|
+
var import_lucide_react78, import_react97, import_jsx_runtime126;
|
|
28706
28782
|
var init_SendFlowSelector = __esm({
|
|
28707
28783
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
28708
28784
|
init_ProviderContext();
|
|
28709
28785
|
init_i18n();
|
|
28710
28786
|
import_lucide_react78 = require("lucide-react");
|
|
28711
|
-
|
|
28787
|
+
import_react97 = require("react");
|
|
28712
28788
|
init_useLayoutDataStore();
|
|
28713
28789
|
init_utils();
|
|
28714
28790
|
init_Expandable2();
|
|
@@ -28771,12 +28847,12 @@ function getServerSnapshot() {
|
|
|
28771
28847
|
return false;
|
|
28772
28848
|
}
|
|
28773
28849
|
function useProMode() {
|
|
28774
|
-
return (0,
|
|
28850
|
+
return (0, import_react98.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
28775
28851
|
}
|
|
28776
|
-
var
|
|
28852
|
+
var import_react98, STORAGE_KEY, EVENT_NAME;
|
|
28777
28853
|
var init_pro_mode = __esm({
|
|
28778
28854
|
"src/internal/lib/pro-mode.ts"() {
|
|
28779
|
-
|
|
28855
|
+
import_react98 = require("react");
|
|
28780
28856
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
28781
28857
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
28782
28858
|
}
|
|
@@ -29582,7 +29658,7 @@ function TransactionsMenu() {
|
|
|
29582
29658
|
const { t } = useT();
|
|
29583
29659
|
useOnboardingTourAvailable(true);
|
|
29584
29660
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
29585
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
29661
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react99.useState)({});
|
|
29586
29662
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
29587
29663
|
const {
|
|
29588
29664
|
data: txHistoryGroups = [],
|
|
@@ -29595,7 +29671,7 @@ function TransactionsMenu() {
|
|
|
29595
29671
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
29596
29672
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
29597
29673
|
});
|
|
29598
|
-
const refreshTxHistory = (0,
|
|
29674
|
+
const refreshTxHistory = (0, import_react99.useCallback)(
|
|
29599
29675
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
29600
29676
|
[qc, chainConfig.id, address]
|
|
29601
29677
|
);
|
|
@@ -29634,14 +29710,14 @@ function TransactionsMenu() {
|
|
|
29634
29710
|
)) })
|
|
29635
29711
|
] });
|
|
29636
29712
|
}
|
|
29637
|
-
var import_react_query57, import_lucide_react80,
|
|
29713
|
+
var import_react_query57, import_lucide_react80, import_react99, import_jsx_runtime128;
|
|
29638
29714
|
var init_TransactionsMenu = __esm({
|
|
29639
29715
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
29640
29716
|
init_SessionContext();
|
|
29641
29717
|
init_i18n();
|
|
29642
29718
|
import_react_query57 = require("@tanstack/react-query");
|
|
29643
29719
|
import_lucide_react80 = require("lucide-react");
|
|
29644
|
-
|
|
29720
|
+
import_react99 = require("react");
|
|
29645
29721
|
init_useLayoutDataStore();
|
|
29646
29722
|
init_Expandable2();
|
|
29647
29723
|
init_Onboarding();
|
|
@@ -29981,7 +30057,7 @@ var init_PageMap = __esm({
|
|
|
29981
30057
|
// src/internal/hooks/usePageMapper.tsx
|
|
29982
30058
|
function usePageMapper() {
|
|
29983
30059
|
const page = useLayoutDataStore((st) => st.page);
|
|
29984
|
-
const closeDialog = (0,
|
|
30060
|
+
const closeDialog = (0, import_react100.useCallback)(() => {
|
|
29985
30061
|
useLayoutStore.setState({ isDialogAnimating: true });
|
|
29986
30062
|
setTimeout(() => {
|
|
29987
30063
|
useLayoutStore.setState({
|
|
@@ -29993,14 +30069,14 @@ function usePageMapper() {
|
|
|
29993
30069
|
});
|
|
29994
30070
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
29995
30071
|
}, []);
|
|
29996
|
-
const openDialog = (0,
|
|
30072
|
+
const openDialog = (0, import_react100.useCallback)((pageItem) => {
|
|
29997
30073
|
useLayoutStore.setState({
|
|
29998
30074
|
dialogContent: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(pageItem.component, {}),
|
|
29999
30075
|
isDialogOpen: true
|
|
30000
30076
|
// isDialogAnimating: true
|
|
30001
30077
|
});
|
|
30002
30078
|
}, []);
|
|
30003
|
-
(0,
|
|
30079
|
+
(0, import_react100.useEffect)(() => {
|
|
30004
30080
|
if (page === null) return closeDialog();
|
|
30005
30081
|
const pageItem = PAGE_MAP[page];
|
|
30006
30082
|
if (!pageItem) {
|
|
@@ -30011,10 +30087,10 @@ function usePageMapper() {
|
|
|
30011
30087
|
openDialog(pageItem);
|
|
30012
30088
|
}, [page, closeDialog, openDialog]);
|
|
30013
30089
|
}
|
|
30014
|
-
var
|
|
30090
|
+
var import_react100, import_jsx_runtime130, CLEAR_DIALOG_TIMEOUT;
|
|
30015
30091
|
var init_usePageMapper = __esm({
|
|
30016
30092
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
30017
|
-
|
|
30093
|
+
import_react100 = require("react");
|
|
30018
30094
|
init_PageMap();
|
|
30019
30095
|
init_constants();
|
|
30020
30096
|
init_useLayoutDataStore();
|
|
@@ -30030,24 +30106,24 @@ function useSettingsNotifications() {
|
|
|
30030
30106
|
const providers = import_auth25.jwtTokenManager.getProviders();
|
|
30031
30107
|
const hasEmail = providers.includes("email");
|
|
30032
30108
|
const { data: userProfile = null } = useUserProfile();
|
|
30033
|
-
(0,
|
|
30109
|
+
(0, import_react101.useEffect)(() => {
|
|
30034
30110
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
30035
30111
|
setSettingsNotifications({
|
|
30036
30112
|
...COMPLETE_KYC_PROGRESS,
|
|
30037
30113
|
status: isKYCVerified ? "resolved" : "active"
|
|
30038
30114
|
});
|
|
30039
30115
|
}, [userProfile, setSettingsNotifications]);
|
|
30040
|
-
(0,
|
|
30116
|
+
(0, import_react101.useEffect)(() => {
|
|
30041
30117
|
setSettingsNotifications({
|
|
30042
30118
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
30043
30119
|
status: hasEmail ? "resolved" : "active"
|
|
30044
30120
|
});
|
|
30045
30121
|
}, [hasEmail, setSettingsNotifications]);
|
|
30046
30122
|
}
|
|
30047
|
-
var
|
|
30123
|
+
var import_react101, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
30048
30124
|
var init_useSettingsNotifications = __esm({
|
|
30049
30125
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
30050
|
-
|
|
30126
|
+
import_react101 = require("react");
|
|
30051
30127
|
init_auth();
|
|
30052
30128
|
init_useLayoutDataStore();
|
|
30053
30129
|
init_useUserProfile();
|
|
@@ -30070,7 +30146,7 @@ var init_package = __esm({
|
|
|
30070
30146
|
"package.json"() {
|
|
30071
30147
|
package_default = {
|
|
30072
30148
|
name: "@embarkai/ui-kit",
|
|
30073
|
-
version: "0.4.
|
|
30149
|
+
version: "0.4.116",
|
|
30074
30150
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
30075
30151
|
type: "module",
|
|
30076
30152
|
main: "./dist/index.cjs",
|
|
@@ -30181,7 +30257,7 @@ function Footer() {
|
|
|
30181
30257
|
const address = useSession((st) => st.address);
|
|
30182
30258
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
30183
30259
|
const isDialogForced = useLayoutStore((st) => st.isDialogForced);
|
|
30184
|
-
const { mutate: wagmiDisconnect } = (
|
|
30260
|
+
const { mutate: wagmiDisconnect } = useSafeDisconnect({
|
|
30185
30261
|
mutation: {
|
|
30186
30262
|
onSuccess: () => {
|
|
30187
30263
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
@@ -30287,7 +30363,7 @@ function Footer() {
|
|
|
30287
30363
|
}
|
|
30288
30364
|
);
|
|
30289
30365
|
}
|
|
30290
|
-
var import_react_query59, import_lucide_react83,
|
|
30366
|
+
var import_react_query59, import_lucide_react83, import_jsx_runtime131, FOOTER_ONBOARDING_CHAIN_BUTTON, FOOTER_ONBOARDING_LOGOUT_BUTTON, FOOTER_TOUR;
|
|
30291
30367
|
var init_Footer = __esm({
|
|
30292
30368
|
"src/internal/components/Footer/Footer.tsx"() {
|
|
30293
30369
|
init_package();
|
|
@@ -30295,9 +30371,9 @@ var init_Footer = __esm({
|
|
|
30295
30371
|
init_ProviderContext();
|
|
30296
30372
|
init_SessionContext();
|
|
30297
30373
|
init_i18n();
|
|
30374
|
+
init_useSafeDisconnect();
|
|
30298
30375
|
import_react_query59 = require("@tanstack/react-query");
|
|
30299
30376
|
import_lucide_react83 = require("lucide-react");
|
|
30300
|
-
import_wagmi9 = require("wagmi");
|
|
30301
30377
|
init_auth();
|
|
30302
30378
|
init_base3();
|
|
30303
30379
|
init_useLayoutDataStore();
|
|
@@ -30405,11 +30481,11 @@ function Header() {
|
|
|
30405
30481
|
const embarkPage = useLayoutDataStore((st) => st.page);
|
|
30406
30482
|
const isOnboardingTourAvailable = useOnboardingStore((st) => st.isTourAvailable);
|
|
30407
30483
|
const proMode = useProMode();
|
|
30408
|
-
const [proToast, setProToast] = (0,
|
|
30409
|
-
const [copied, setCopied] = (0,
|
|
30410
|
-
const clickCountRef = (0,
|
|
30411
|
-
const clickTimerRef = (0,
|
|
30412
|
-
const handleAvatarClick = (0,
|
|
30484
|
+
const [proToast, setProToast] = (0, import_react102.useState)(false);
|
|
30485
|
+
const [copied, setCopied] = (0, import_react102.useState)(false);
|
|
30486
|
+
const clickCountRef = (0, import_react102.useRef)(0);
|
|
30487
|
+
const clickTimerRef = (0, import_react102.useRef)(null);
|
|
30488
|
+
const handleAvatarClick = (0, import_react102.useCallback)(() => {
|
|
30413
30489
|
clickCountRef.current += 1;
|
|
30414
30490
|
if (clickTimerRef.current) {
|
|
30415
30491
|
clearTimeout(clickTimerRef.current);
|
|
@@ -30515,7 +30591,7 @@ function Header() {
|
|
|
30515
30591
|
}
|
|
30516
30592
|
);
|
|
30517
30593
|
}
|
|
30518
|
-
var import_lucide_react84,
|
|
30594
|
+
var import_lucide_react84, import_react102, import_jsx_runtime132;
|
|
30519
30595
|
var init_Header = __esm({
|
|
30520
30596
|
"src/internal/components/Header/Header.tsx"() {
|
|
30521
30597
|
init_lumia2();
|
|
@@ -30523,7 +30599,7 @@ var init_Header = __esm({
|
|
|
30523
30599
|
init_ProviderContext();
|
|
30524
30600
|
init_SessionContext();
|
|
30525
30601
|
import_lucide_react84 = require("lucide-react");
|
|
30526
|
-
|
|
30602
|
+
import_react102 = require("react");
|
|
30527
30603
|
init_icons();
|
|
30528
30604
|
init_auth();
|
|
30529
30605
|
init_useLayoutDataStore();
|
|
@@ -30558,7 +30634,7 @@ function useDecideContentStyles() {
|
|
|
30558
30634
|
style: (0, import_lodash_es17.merge)({}, mobileStyles)
|
|
30559
30635
|
};
|
|
30560
30636
|
}
|
|
30561
|
-
var DialogPrimitive, import_lodash_es17, import_lucide_react85,
|
|
30637
|
+
var DialogPrimitive, import_lodash_es17, import_lucide_react85, import_react103, import_jsx_runtime133, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
30562
30638
|
var init_dialog = __esm({
|
|
30563
30639
|
"src/internal/components/ui/dialog.tsx"() {
|
|
30564
30640
|
init_utils();
|
|
@@ -30567,14 +30643,14 @@ var init_dialog = __esm({
|
|
|
30567
30643
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
30568
30644
|
import_lodash_es17 = require("lodash-es");
|
|
30569
30645
|
import_lucide_react85 = require("lucide-react");
|
|
30570
|
-
|
|
30646
|
+
import_react103 = require("react");
|
|
30571
30647
|
init_useLayoutDataStore();
|
|
30572
30648
|
init_useLayoutStore();
|
|
30573
30649
|
init_button();
|
|
30574
30650
|
import_jsx_runtime133 = require("react/jsx-runtime");
|
|
30575
30651
|
Dialog = DialogPrimitive.Root;
|
|
30576
30652
|
DialogPortal = DialogPrimitive.Portal;
|
|
30577
|
-
DialogOverlay = (0,
|
|
30653
|
+
DialogOverlay = (0, import_react103.forwardRef)(
|
|
30578
30654
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30579
30655
|
DialogPrimitive.Overlay,
|
|
30580
30656
|
{
|
|
@@ -30596,7 +30672,7 @@ var init_dialog = __esm({
|
|
|
30596
30672
|
border: "1px solid var(--ui-kit-bd)",
|
|
30597
30673
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
30598
30674
|
};
|
|
30599
|
-
DialogContent = (0,
|
|
30675
|
+
DialogContent = (0, import_react103.forwardRef)(
|
|
30600
30676
|
({ className, children, colorMode, ...props }, ref) => {
|
|
30601
30677
|
const { t, i18n } = useT();
|
|
30602
30678
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -30707,7 +30783,7 @@ var init_dialog = __esm({
|
|
|
30707
30783
|
DialogHeader.displayName = "DialogHeader";
|
|
30708
30784
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: cn2("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
30709
30785
|
DialogFooter.displayName = "DialogFooter";
|
|
30710
|
-
DialogTitle = (0,
|
|
30786
|
+
DialogTitle = (0, import_react103.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30711
30787
|
DialogPrimitive.Title,
|
|
30712
30788
|
{
|
|
30713
30789
|
ref,
|
|
@@ -30716,7 +30792,7 @@ var init_dialog = __esm({
|
|
|
30716
30792
|
}
|
|
30717
30793
|
));
|
|
30718
30794
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
30719
|
-
DialogDescription = (0,
|
|
30795
|
+
DialogDescription = (0, import_react103.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DialogPrimitive.Description, { ref, className: cn2("text-sm text-muted-foreground", className), ...props }));
|
|
30720
30796
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
30721
30797
|
}
|
|
30722
30798
|
});
|
|
@@ -30739,7 +30815,7 @@ function Dialog2() {
|
|
|
30739
30815
|
const { colorMode, maxScrollHeight, isDialogOpen, dialogContent, isDialogForced } = useLayoutStore();
|
|
30740
30816
|
const page = useLayoutDataStore((st) => st.page);
|
|
30741
30817
|
const transitionPageHeight = useLayoutDataStore((st) => st.transitionPageHeight);
|
|
30742
|
-
(0,
|
|
30818
|
+
(0, import_react105.useEffect)(() => useLayoutStore.setState({ isSettings: !!session }), [session]);
|
|
30743
30819
|
usePageMapper();
|
|
30744
30820
|
useAutoConnect();
|
|
30745
30821
|
useBackupStatusChanges();
|
|
@@ -30770,8 +30846,8 @@ function Dialog2() {
|
|
|
30770
30846
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DialogTitle, { children: "embarkAI" }) }),
|
|
30771
30847
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DialogDescription, { className: "sr-only", children: "embarkAI wallet" }),
|
|
30772
30848
|
!isHeaderHidden && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Header, {}),
|
|
30773
|
-
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30774
|
-
|
|
30849
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_react104.AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30850
|
+
import_react104.motion.div,
|
|
30775
30851
|
{
|
|
30776
30852
|
style: { overflow: "hidden" },
|
|
30777
30853
|
initial: { opacity: 0, height: transitionPageHeight },
|
|
@@ -30800,13 +30876,13 @@ function Dialog2() {
|
|
|
30800
30876
|
}
|
|
30801
30877
|
);
|
|
30802
30878
|
}
|
|
30803
|
-
var
|
|
30879
|
+
var import_react104, import_react105, import_jsx_runtime135;
|
|
30804
30880
|
var init_Dialog = __esm({
|
|
30805
30881
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
30806
30882
|
init_ProviderContext();
|
|
30807
30883
|
init_SessionContext();
|
|
30808
|
-
|
|
30809
|
-
|
|
30884
|
+
import_react104 = require("motion/react");
|
|
30885
|
+
import_react105 = require("react");
|
|
30810
30886
|
init_constants();
|
|
30811
30887
|
init_useAllowExternalModalsScroll();
|
|
30812
30888
|
init_useAutoConnect();
|
|
@@ -30840,13 +30916,13 @@ function DirectWalletHandler() {
|
|
|
30840
30916
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
30841
30917
|
const externalConnectorName = useExternalWalletStore((st) => st.connectorName);
|
|
30842
30918
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
30843
|
-
const { address, isConnected, chainId, connector } = (0,
|
|
30844
|
-
(0,
|
|
30919
|
+
const { address, isConnected, chainId, connector } = (0, import_wagmi8.useConnection)();
|
|
30920
|
+
(0, import_react106.useEffect)(() => {
|
|
30845
30921
|
const { setConfigMode, setActiveMode } = useExternalWalletStore.getState();
|
|
30846
30922
|
setConfigMode(walletMode);
|
|
30847
30923
|
if (walletMode !== "both") setActiveMode(walletMode);
|
|
30848
30924
|
}, [walletMode]);
|
|
30849
|
-
(0,
|
|
30925
|
+
(0, import_react106.useEffect)(() => {
|
|
30850
30926
|
if ((!!externalAddress || isExternalConnected) && !isConnected) {
|
|
30851
30927
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
30852
30928
|
return;
|
|
@@ -30868,25 +30944,25 @@ function DirectWalletHandler() {
|
|
|
30868
30944
|
]);
|
|
30869
30945
|
return null;
|
|
30870
30946
|
}
|
|
30871
|
-
var
|
|
30947
|
+
var import_react106, import_wagmi8;
|
|
30872
30948
|
var init_DirectWalletHandler = __esm({
|
|
30873
30949
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
30874
|
-
|
|
30875
|
-
|
|
30950
|
+
import_react106 = require("react");
|
|
30951
|
+
import_wagmi8 = require("wagmi");
|
|
30876
30952
|
init_ProviderContext();
|
|
30877
30953
|
init_useExternalWalletStore();
|
|
30878
30954
|
}
|
|
30879
30955
|
});
|
|
30880
30956
|
|
|
30881
30957
|
// src/internal/components/TssManager.tsx
|
|
30882
|
-
var
|
|
30958
|
+
var import_react107, TssManagerWithRef;
|
|
30883
30959
|
var init_TssManager = __esm({
|
|
30884
30960
|
"src/internal/components/TssManager.tsx"() {
|
|
30885
30961
|
init_SessionContext();
|
|
30886
|
-
|
|
30962
|
+
import_react107 = __toESM(require("react"), 1);
|
|
30887
30963
|
init_auth();
|
|
30888
30964
|
init_clients();
|
|
30889
|
-
TssManagerWithRef =
|
|
30965
|
+
TssManagerWithRef = import_react107.default.forwardRef((props, ref) => {
|
|
30890
30966
|
const { mpcPin } = props;
|
|
30891
30967
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
30892
30968
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -30894,14 +30970,14 @@ var init_TssManager = __esm({
|
|
|
30894
30970
|
const setStatus = useSession((st) => st.setStatus);
|
|
30895
30971
|
const setSession = useSession((st) => st.setSession);
|
|
30896
30972
|
const setAddress = useSession((st) => st.setAddress);
|
|
30897
|
-
const onSessionCreated = (0,
|
|
30973
|
+
const onSessionCreated = (0, import_react107.useCallback)(
|
|
30898
30974
|
(session, address) => {
|
|
30899
30975
|
setSession(session);
|
|
30900
30976
|
setAddress(address);
|
|
30901
30977
|
},
|
|
30902
30978
|
[setSession, setAddress]
|
|
30903
30979
|
);
|
|
30904
|
-
const createSessionWithKeyshare =
|
|
30980
|
+
const createSessionWithKeyshare = import_react107.default.useCallback(
|
|
30905
30981
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
30906
30982
|
setStatus("checking key management setup...");
|
|
30907
30983
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -30926,7 +31002,7 @@ var init_TssManager = __esm({
|
|
|
30926
31002
|
},
|
|
30927
31003
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
30928
31004
|
);
|
|
30929
|
-
|
|
31005
|
+
import_react107.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
30930
31006
|
return null;
|
|
30931
31007
|
});
|
|
30932
31008
|
}
|
|
@@ -30950,7 +31026,7 @@ function waitForStoreHydration() {
|
|
|
30950
31026
|
}
|
|
30951
31027
|
function SessionProvider({ children }) {
|
|
30952
31028
|
const config = useProviderConfig().config;
|
|
30953
|
-
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
|
|
31029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_react108.Fragment, {
|
|
30954
31030
|
/** dApp's router might have its own error boundaries setup via imported @embarkai/ui-kitErrorBoundary */
|
|
30955
31031
|
children: [
|
|
30956
31032
|
children,
|
|
@@ -30970,11 +31046,11 @@ function SessionProvider({ children }) {
|
|
|
30970
31046
|
]
|
|
30971
31047
|
});
|
|
30972
31048
|
}
|
|
30973
|
-
var import_read22,
|
|
31049
|
+
var import_read22, import_react108, import_zustand19, import_middleware5, import_jsx_runtime136, useSession, requireActiveChainId;
|
|
30974
31050
|
var init_SessionContext = __esm({
|
|
30975
31051
|
"src/context/SessionContext.tsx"() {
|
|
30976
31052
|
import_read22 = require("@embarkai/core/read");
|
|
30977
|
-
|
|
31053
|
+
import_react108 = require("react");
|
|
30978
31054
|
import_zustand19 = require("zustand");
|
|
30979
31055
|
import_middleware5 = require("zustand/middleware");
|
|
30980
31056
|
init_ErrorBoundary2();
|
|
@@ -32324,7 +32400,7 @@ var init_iframe_manager = __esm({
|
|
|
32324
32400
|
*/
|
|
32325
32401
|
handleMessage(event) {
|
|
32326
32402
|
const message = event.data;
|
|
32327
|
-
if (!message || typeof message !== "object" || !message.type) {
|
|
32403
|
+
if (!message || typeof message !== "object" || typeof message.type !== "string" || !message.type) {
|
|
32328
32404
|
return;
|
|
32329
32405
|
}
|
|
32330
32406
|
message.type = this.normalizeMessageType(message.type);
|
|
@@ -33429,11 +33505,11 @@ function clearLegacyWagmiStorage() {
|
|
|
33429
33505
|
}
|
|
33430
33506
|
function Provider(props) {
|
|
33431
33507
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
33432
|
-
const callbacksRef = (0,
|
|
33433
|
-
(0,
|
|
33434
|
-
const config = (0,
|
|
33435
|
-
const wagmiConfig3 = (0,
|
|
33436
|
-
const updateConfig = (0,
|
|
33508
|
+
const callbacksRef = (0, import_react109.useRef)(callbacks);
|
|
33509
|
+
(0, import_react109.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
33510
|
+
const config = (0, import_react109.useRef)((0, import_lodash_es18.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
33511
|
+
const wagmiConfig3 = (0, import_react109.useRef)((0, import_core9.getWagmiConfig)(config.current?.wallet?.walletConnectId || null));
|
|
33512
|
+
const updateConfig = (0, import_react109.useCallback)((updates) => {
|
|
33437
33513
|
const prev = config.current;
|
|
33438
33514
|
const next = { ...prev };
|
|
33439
33515
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -33467,12 +33543,12 @@ function Provider(props) {
|
|
|
33467
33543
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
33468
33544
|
config.current = next;
|
|
33469
33545
|
}, []);
|
|
33470
|
-
const updateCallbacks = (0,
|
|
33546
|
+
const updateCallbacks = (0, import_react109.useCallback)((updates) => {
|
|
33471
33547
|
const prev = callbacksRef.current;
|
|
33472
33548
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
33473
33549
|
callbacksRef.current = next;
|
|
33474
33550
|
}, []);
|
|
33475
|
-
(0,
|
|
33551
|
+
(0, import_react109.useEffect)(() => {
|
|
33476
33552
|
if (typeof window === "undefined" || !projectId) return;
|
|
33477
33553
|
const mergedConfig = (0, import_lodash_es18.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
33478
33554
|
updateConfig(mergedConfig);
|
|
@@ -33492,7 +33568,7 @@ function Provider(props) {
|
|
|
33492
33568
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
33493
33569
|
}
|
|
33494
33570
|
}, [projectId, initialConfig]);
|
|
33495
|
-
(0,
|
|
33571
|
+
(0, import_react109.useEffect)(() => {
|
|
33496
33572
|
if (typeof window === "undefined" || !projectId) return;
|
|
33497
33573
|
try {
|
|
33498
33574
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -33521,7 +33597,7 @@ function Provider(props) {
|
|
|
33521
33597
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
33522
33598
|
}
|
|
33523
33599
|
}, [projectId]);
|
|
33524
|
-
const contextValue = (0,
|
|
33600
|
+
const contextValue = (0, import_react109.useMemo)(
|
|
33525
33601
|
() => ({
|
|
33526
33602
|
config,
|
|
33527
33603
|
updateConfig,
|
|
@@ -33532,24 +33608,24 @@ function Provider(props) {
|
|
|
33532
33608
|
}),
|
|
33533
33609
|
[config, updateConfig, callbacks, updateCallbacks]
|
|
33534
33610
|
);
|
|
33535
|
-
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
33611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_wagmi9.WagmiProvider, { config: wagmiConfig3.current, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SessionProvider, { children }) }) });
|
|
33536
33612
|
}
|
|
33537
|
-
var import_core9, import_error_tracking4, import_lodash_es18,
|
|
33613
|
+
var import_core9, import_error_tracking4, import_lodash_es18, import_react109, import_wagmi9, import_jsx_runtime137, UIContext, useProviderConfig;
|
|
33538
33614
|
var init_ProviderContext = __esm({
|
|
33539
33615
|
"src/context/ProviderContext.tsx"() {
|
|
33540
33616
|
import_core9 = require("@embarkai/core");
|
|
33541
33617
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
33542
33618
|
import_lodash_es18 = require("lodash-es");
|
|
33543
|
-
|
|
33544
|
-
|
|
33619
|
+
import_react109 = require("react");
|
|
33620
|
+
import_wagmi9 = require("wagmi");
|
|
33545
33621
|
init_initial();
|
|
33546
33622
|
init_iframe_manager();
|
|
33547
33623
|
init_SessionContext();
|
|
33548
33624
|
init_utils14();
|
|
33549
33625
|
import_jsx_runtime137 = require("react/jsx-runtime");
|
|
33550
|
-
UIContext = (0,
|
|
33626
|
+
UIContext = (0, import_react109.createContext)(void 0);
|
|
33551
33627
|
useProviderConfig = () => {
|
|
33552
|
-
const ctx = (0,
|
|
33628
|
+
const ctx = (0, import_react109.useContext)(UIContext);
|
|
33553
33629
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
33554
33630
|
return ctx;
|
|
33555
33631
|
};
|
|
@@ -33672,7 +33748,7 @@ init_ErrorBoundary2();
|
|
|
33672
33748
|
init_lumia2();
|
|
33673
33749
|
init_embarkAI2();
|
|
33674
33750
|
var import_lucide_react86 = require("lucide-react");
|
|
33675
|
-
var
|
|
33751
|
+
var import_react110 = require("react");
|
|
33676
33752
|
init_SessionContext();
|
|
33677
33753
|
init_auth();
|
|
33678
33754
|
init_BalanceView2();
|
|
@@ -33705,10 +33781,10 @@ function ConnectWalletButton(props) {
|
|
|
33705
33781
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
33706
33782
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
33707
33783
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
33708
|
-
(0,
|
|
33784
|
+
(0, import_react110.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
33709
33785
|
const { data: profile, isLoading: isProfileLoading } = useUserProfile();
|
|
33710
33786
|
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth25.jwtTokenManager.getDisplayName();
|
|
33711
|
-
const indicators = (0,
|
|
33787
|
+
const indicators = (0, import_react110.useMemo)(() => {
|
|
33712
33788
|
const userId = session?.mpcUserId;
|
|
33713
33789
|
if (!userId) return { server: false, local: false, backup: false };
|
|
33714
33790
|
const server = import_auth25.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -34347,14 +34423,14 @@ var Hash = ({
|
|
|
34347
34423
|
};
|
|
34348
34424
|
|
|
34349
34425
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
34350
|
-
var
|
|
34426
|
+
var import_react111 = require("react");
|
|
34351
34427
|
init_base3();
|
|
34352
34428
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
34353
34429
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
34354
|
-
const [transactions, setTransactions] = (0,
|
|
34355
|
-
const [loading, setLoading] = (0,
|
|
34356
|
-
const [error, setError] = (0,
|
|
34357
|
-
(0,
|
|
34430
|
+
const [transactions, setTransactions] = (0, import_react111.useState)([]);
|
|
34431
|
+
const [loading, setLoading] = (0, import_react111.useState)(true);
|
|
34432
|
+
const [error, setError] = (0, import_react111.useState)(null);
|
|
34433
|
+
(0, import_react111.useEffect)(() => {
|
|
34358
34434
|
const fetchTransactions2 = async () => {
|
|
34359
34435
|
try {
|
|
34360
34436
|
setLoading(true);
|
|
@@ -34645,13 +34721,13 @@ function useUserOpStatus(options = {}) {
|
|
|
34645
34721
|
init_useErc3643Compliance();
|
|
34646
34722
|
|
|
34647
34723
|
// src/hooks/useWalletMode.ts
|
|
34648
|
-
var
|
|
34724
|
+
var import_react112 = require("react");
|
|
34649
34725
|
init_useExternalWalletStore();
|
|
34650
34726
|
function useWalletMode() {
|
|
34651
34727
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
34652
34728
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
34653
34729
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
34654
|
-
const switchMode = (0,
|
|
34730
|
+
const switchMode = (0, import_react112.useCallback)(
|
|
34655
34731
|
(mode) => {
|
|
34656
34732
|
if (configMode !== "both") return;
|
|
34657
34733
|
setActiveMode(mode);
|
|
@@ -34668,8 +34744,8 @@ function useWalletMode() {
|
|
|
34668
34744
|
|
|
34669
34745
|
// src/hooks/useDirectWallet.ts
|
|
34670
34746
|
init_useOpenPage();
|
|
34671
|
-
|
|
34672
|
-
var
|
|
34747
|
+
init_useSafeDisconnect();
|
|
34748
|
+
var import_react113 = require("react");
|
|
34673
34749
|
init_useExternalWalletStore();
|
|
34674
34750
|
function useDirectWallet() {
|
|
34675
34751
|
const address = useExternalWalletStore((st) => st.externalAddress);
|
|
@@ -34677,11 +34753,11 @@ function useDirectWallet() {
|
|
|
34677
34753
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
34678
34754
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
34679
34755
|
const { open: openEmbarkAI } = useOpenPage();
|
|
34680
|
-
const { mutate: wagmiDisconnect } = (
|
|
34681
|
-
const connect = (0,
|
|
34756
|
+
const { mutate: wagmiDisconnect } = useSafeDisconnect();
|
|
34757
|
+
const connect = (0, import_react113.useCallback)((connectFlowType = "connect") => {
|
|
34682
34758
|
openEmbarkAI("connect-external-wallet" /* CONNECT_EXTERNAL_WALLET */, { connectFlowType });
|
|
34683
34759
|
}, []);
|
|
34684
|
-
const disconnect = (0,
|
|
34760
|
+
const disconnect = (0, import_react113.useCallback)(() => {
|
|
34685
34761
|
wagmiDisconnect();
|
|
34686
34762
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
34687
34763
|
}, [wagmiDisconnect]);
|
|
@@ -34697,9 +34773,9 @@ function useDirectWallet() {
|
|
|
34697
34773
|
}
|
|
34698
34774
|
|
|
34699
34775
|
// src/hooks/useSendDirectTransaction.ts
|
|
34700
|
-
var
|
|
34776
|
+
var import_react114 = require("react");
|
|
34701
34777
|
var import_viem23 = require("viem");
|
|
34702
|
-
var
|
|
34778
|
+
var import_wagmi10 = require("wagmi");
|
|
34703
34779
|
|
|
34704
34780
|
// src/internal/lib/direct-transaction.ts
|
|
34705
34781
|
async function submitDirectTransaction(request, deps) {
|
|
@@ -34717,13 +34793,13 @@ async function submitDirectTransaction(request, deps) {
|
|
|
34717
34793
|
init_useExternalWalletStore();
|
|
34718
34794
|
function useSendDirectTransaction() {
|
|
34719
34795
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
34720
|
-
const { connector } = (0,
|
|
34721
|
-
const { sendTransactionAsync: sendWagmiTransactionAsync } = (0,
|
|
34722
|
-
const { switchChainAsync } = (0,
|
|
34723
|
-
const [isPending, setIsPending] = (0,
|
|
34724
|
-
const [error, setError] = (0,
|
|
34725
|
-
const [txHash, setTxHash] = (0,
|
|
34726
|
-
const sendTransactionAsync = (0,
|
|
34796
|
+
const { connector } = (0, import_wagmi10.useConnection)();
|
|
34797
|
+
const { sendTransactionAsync: sendWagmiTransactionAsync } = (0, import_wagmi10.useSendTransaction)();
|
|
34798
|
+
const { switchChainAsync } = (0, import_wagmi10.useSwitchChain)();
|
|
34799
|
+
const [isPending, setIsPending] = (0, import_react114.useState)(false);
|
|
34800
|
+
const [error, setError] = (0, import_react114.useState)(null);
|
|
34801
|
+
const [txHash, setTxHash] = (0, import_react114.useState)(null);
|
|
34802
|
+
const sendTransactionAsync = (0, import_react114.useCallback)(
|
|
34727
34803
|
async (params) => {
|
|
34728
34804
|
if (!isConnected || !connector) {
|
|
34729
34805
|
const message = "No external wallet connected";
|
|
@@ -34760,7 +34836,7 @@ function useSendDirectTransaction() {
|
|
|
34760
34836
|
},
|
|
34761
34837
|
[isConnected, connector, sendWagmiTransactionAsync, switchChainAsync]
|
|
34762
34838
|
);
|
|
34763
|
-
const sendTransaction = (0,
|
|
34839
|
+
const sendTransaction = (0, import_react114.useCallback)(
|
|
34764
34840
|
async (params) => {
|
|
34765
34841
|
try {
|
|
34766
34842
|
return await sendTransactionAsync(params);
|
|
@@ -34770,7 +34846,7 @@ function useSendDirectTransaction() {
|
|
|
34770
34846
|
},
|
|
34771
34847
|
[sendTransactionAsync]
|
|
34772
34848
|
);
|
|
34773
|
-
const reset = (0,
|
|
34849
|
+
const reset = (0, import_react114.useCallback)(() => {
|
|
34774
34850
|
setError(null);
|
|
34775
34851
|
setTxHash(null);
|
|
34776
34852
|
setIsPending(false);
|
|
@@ -34779,7 +34855,7 @@ function useSendDirectTransaction() {
|
|
|
34779
34855
|
}
|
|
34780
34856
|
|
|
34781
34857
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
34782
|
-
var
|
|
34858
|
+
var import_react115 = require("react");
|
|
34783
34859
|
var import_viem24 = require("viem");
|
|
34784
34860
|
init_SessionContext();
|
|
34785
34861
|
init_account2();
|
|
@@ -34798,14 +34874,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
34798
34874
|
function useTransferToLinkedWallet() {
|
|
34799
34875
|
const session = useSession((st) => st.session);
|
|
34800
34876
|
const { profiles } = useLinkedProfiles();
|
|
34801
|
-
const [isPending, setIsPending] = (0,
|
|
34802
|
-
const [error, setError] = (0,
|
|
34803
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
34804
|
-
const linkedWallets = (0,
|
|
34877
|
+
const [isPending, setIsPending] = (0, import_react115.useState)(false);
|
|
34878
|
+
const [error, setError] = (0, import_react115.useState)(null);
|
|
34879
|
+
const [userOpHash, setUserOpHash] = (0, import_react115.useState)(null);
|
|
34880
|
+
const linkedWallets = (0, import_react115.useMemo)(
|
|
34805
34881
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
34806
34882
|
[profiles]
|
|
34807
34883
|
);
|
|
34808
|
-
const transfer = (0,
|
|
34884
|
+
const transfer = (0, import_react115.useCallback)(
|
|
34809
34885
|
async (params) => {
|
|
34810
34886
|
if (!session) {
|
|
34811
34887
|
setError("No active session");
|
|
@@ -34856,7 +34932,7 @@ function useTransferToLinkedWallet() {
|
|
|
34856
34932
|
},
|
|
34857
34933
|
[session, linkedWallets]
|
|
34858
34934
|
);
|
|
34859
|
-
const reset = (0,
|
|
34935
|
+
const reset = (0, import_react115.useCallback)(() => {
|
|
34860
34936
|
setError(null);
|
|
34861
34937
|
setUserOpHash(null);
|
|
34862
34938
|
setIsPending(false);
|
|
@@ -34865,11 +34941,11 @@ function useTransferToLinkedWallet() {
|
|
|
34865
34941
|
}
|
|
34866
34942
|
|
|
34867
34943
|
// src/hooks/useNativeWalletSignature.ts
|
|
34868
|
-
var
|
|
34944
|
+
var import_wagmi11 = require("wagmi");
|
|
34869
34945
|
init_providers();
|
|
34870
34946
|
function useNativeWalletSignature() {
|
|
34871
|
-
const signMessage = (0,
|
|
34872
|
-
const signTypedMessage = (0,
|
|
34947
|
+
const signMessage = (0, import_wagmi11.useSignMessage)();
|
|
34948
|
+
const signTypedMessage = (0, import_wagmi11.useSignTypedData)();
|
|
34873
34949
|
return {
|
|
34874
34950
|
signMessage,
|
|
34875
34951
|
/** EIP-712 signature */
|
|
@@ -34879,16 +34955,16 @@ function useNativeWalletSignature() {
|
|
|
34879
34955
|
}
|
|
34880
34956
|
|
|
34881
34957
|
// src/hooks/useLogout.ts
|
|
34958
|
+
init_useSafeDisconnect();
|
|
34882
34959
|
var import_auth27 = require("@embarkai/core/auth");
|
|
34883
|
-
var
|
|
34884
|
-
var import_wagmi15 = require("wagmi");
|
|
34960
|
+
var import_react116 = require("react");
|
|
34885
34961
|
init_ProviderContext();
|
|
34886
34962
|
init_SessionContext();
|
|
34887
34963
|
init_useExternalWalletStore();
|
|
34888
34964
|
function useLogout() {
|
|
34889
34965
|
const { callbacksRef } = useProviderConfig();
|
|
34890
34966
|
const address = useSession((st) => st.address);
|
|
34891
|
-
const { mutate: wagmiDisconnect } = (
|
|
34967
|
+
const { mutate: wagmiDisconnect } = useSafeDisconnect({
|
|
34892
34968
|
mutation: {
|
|
34893
34969
|
onSuccess: () => {
|
|
34894
34970
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
@@ -34899,7 +34975,7 @@ function useLogout() {
|
|
|
34899
34975
|
}
|
|
34900
34976
|
}
|
|
34901
34977
|
});
|
|
34902
|
-
const logout2 = (0,
|
|
34978
|
+
const logout2 = (0, import_react116.useCallback)(async () => {
|
|
34903
34979
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
34904
34980
|
const prevAddress = address;
|
|
34905
34981
|
let userId = null;
|
|
@@ -34954,13 +35030,13 @@ init_useBlockscoutAssets2();
|
|
|
34954
35030
|
init_SessionContext();
|
|
34955
35031
|
var import_read24 = require("@embarkai/core/read");
|
|
34956
35032
|
var import_viem25 = require("viem");
|
|
34957
|
-
var
|
|
35033
|
+
var import_wagmi12 = require("wagmi");
|
|
34958
35034
|
function useTransactions() {
|
|
34959
35035
|
const chainId = requireActiveChainId();
|
|
34960
35036
|
const viemChain = (0, import_read24.getViemChain)(chainId);
|
|
34961
|
-
const publicClient = (0,
|
|
34962
|
-
const { data: walletClient } = (0,
|
|
34963
|
-
const { address } = (0,
|
|
35037
|
+
const publicClient = (0, import_wagmi12.usePublicClient)({ chainId });
|
|
35038
|
+
const { data: walletClient } = (0, import_wagmi12.useWalletClient)();
|
|
35039
|
+
const { address } = (0, import_wagmi12.useAccount)();
|
|
34964
35040
|
const sendTransaction = async (params) => {
|
|
34965
35041
|
if (!walletClient) {
|
|
34966
35042
|
throw new Error("Wallet not connected");
|
|
@@ -35018,9 +35094,9 @@ function useTransactions() {
|
|
|
35018
35094
|
|
|
35019
35095
|
// src/modules/assets.ts
|
|
35020
35096
|
init_SessionContext();
|
|
35021
|
-
var
|
|
35097
|
+
var import_react117 = __toESM(require("react"), 1);
|
|
35022
35098
|
var import_viem26 = require("viem");
|
|
35023
|
-
var
|
|
35099
|
+
var import_wagmi13 = require("wagmi");
|
|
35024
35100
|
var COMMON_TOKENS = [
|
|
35025
35101
|
// Add real token addresses here when available
|
|
35026
35102
|
// {
|
|
@@ -35037,7 +35113,7 @@ function useAssets(address) {
|
|
|
35037
35113
|
data: nativeBalance,
|
|
35038
35114
|
isLoading: nativeBalanceLoading,
|
|
35039
35115
|
refetch: refetchNativeBalance
|
|
35040
|
-
} = (0,
|
|
35116
|
+
} = (0, import_wagmi13.useBalance)({
|
|
35041
35117
|
address,
|
|
35042
35118
|
chainId,
|
|
35043
35119
|
query: {
|
|
@@ -35055,7 +35131,7 @@ function useAssets(address) {
|
|
|
35055
35131
|
data: tokenBalances,
|
|
35056
35132
|
isLoading: tokenBalancesLoading,
|
|
35057
35133
|
refetch: refetchTokenBalances
|
|
35058
|
-
} = (0,
|
|
35134
|
+
} = (0, import_wagmi13.useReadContracts)({
|
|
35059
35135
|
contracts: tokenContracts,
|
|
35060
35136
|
query: {
|
|
35061
35137
|
enabled: !!address && COMMON_TOKENS.length > 0
|
|
@@ -35131,7 +35207,7 @@ function useAssets(address) {
|
|
|
35131
35207
|
}
|
|
35132
35208
|
function useTokenInfo(tokenAddress) {
|
|
35133
35209
|
const chainId = requireActiveChainId();
|
|
35134
|
-
const readContractsResult = (0,
|
|
35210
|
+
const readContractsResult = (0, import_wagmi13.useReadContracts)({
|
|
35135
35211
|
contracts: [
|
|
35136
35212
|
{ address: tokenAddress, abi: import_viem26.erc20Abi, functionName: "name", chainId },
|
|
35137
35213
|
{ address: tokenAddress, abi: import_viem26.erc20Abi, functionName: "symbol", chainId },
|
|
@@ -35162,7 +35238,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
|
|
|
35162
35238
|
data: balance,
|
|
35163
35239
|
isLoading,
|
|
35164
35240
|
refetch
|
|
35165
|
-
} = (0,
|
|
35241
|
+
} = (0, import_wagmi13.useReadContract)({
|
|
35166
35242
|
address: tokenAddress,
|
|
35167
35243
|
abi: import_viem26.erc20Abi,
|
|
35168
35244
|
functionName: "balanceOf",
|
|
@@ -35173,7 +35249,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
|
|
|
35173
35249
|
}
|
|
35174
35250
|
});
|
|
35175
35251
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
35176
|
-
const formattedBalance =
|
|
35252
|
+
const formattedBalance = import_react117.default.useMemo(() => {
|
|
35177
35253
|
if (!balance || !tokenInfo) return "0";
|
|
35178
35254
|
return (0, import_viem26.formatUnits)(balance, tokenInfo.decimals);
|
|
35179
35255
|
}, [balance, tokenInfo]);
|