@embarkai/ui-kit 0.4.31 → 0.4.33
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/_headers +3 -3
- package/dist/iframe/index.html +2 -2
- package/dist/iframe/main.js +69 -64
- package/dist/index.cjs +708 -550
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +417 -259
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -89,19 +89,22 @@ function getServiceUrls() {
|
|
|
89
89
|
const config = DEFAULT_PROVIDER_CONFIG;
|
|
90
90
|
const globalOverride = typeof window !== "undefined" && window.__EMBARK_SERVICES__ || {};
|
|
91
91
|
const searchParams = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : void 0;
|
|
92
|
+
const paramAssetApi = searchParams?.get("assetApiUrl") || void 0;
|
|
92
93
|
const paramTss = searchParams?.get("tssUrl") || void 0;
|
|
93
94
|
const paramVault = searchParams?.get("shareVaultUrl") || void 0;
|
|
94
95
|
const paramDashboard = searchParams?.get("dashboardApiUrl") || void 0;
|
|
95
|
-
const
|
|
96
|
-
const
|
|
96
|
+
const buildAssetApi = "https://api.embarkai.io/on-ramp/api";
|
|
97
|
+
const buildTss = "https://api.embarkai.io/tss";
|
|
98
|
+
const buildVault = "https://api.embarkai.io/vault";
|
|
97
99
|
const buildRequireWasm = false;
|
|
98
100
|
const buildWasmDebug = false;
|
|
99
101
|
const defaultTss = "/tss";
|
|
100
102
|
const defaultVault = "/vault";
|
|
101
103
|
const result = {
|
|
104
|
+
assetApiUrl: paramAssetApi || globalOverride.assetApiUrl || buildAssetApi || config.services.assetApiUrl,
|
|
102
105
|
tssUrl: paramTss || globalOverride.tssUrl || buildTss || config.services.tssUrl || defaultTss,
|
|
103
106
|
shareVaultUrl: paramVault || globalOverride.shareVaultUrl || buildVault || config.services.shareVaultUrl || defaultVault,
|
|
104
|
-
dashboardApiUrl: paramDashboard || globalOverride.dashboardApiUrl || config.services.dashboardApiUrl || "https://dashboard.
|
|
107
|
+
dashboardApiUrl: paramDashboard || globalOverride.dashboardApiUrl || config.services.dashboardApiUrl || "https://dashboard.embarkai.io/api",
|
|
105
108
|
tssRequireWasm: globalOverride.tssRequireWasm ?? buildRequireWasm ?? config.services.tssRequireWasm ?? false,
|
|
106
109
|
tssWasmDebug: globalOverride.tssWasmDebug ?? buildWasmDebug ?? config.services.tssWasmDebug ?? false
|
|
107
110
|
};
|
|
@@ -109,8 +112,8 @@ function getServiceUrls() {
|
|
|
109
112
|
}
|
|
110
113
|
function getIframeUrl() {
|
|
111
114
|
const config = DEFAULT_PROVIDER_CONFIG;
|
|
112
|
-
const buildIframeUrl = "https://auth.
|
|
113
|
-
const iframeUrl = buildIframeUrl || config.services.iframeUrl || "https://auth.
|
|
115
|
+
const buildIframeUrl = "https://auth.embarkai.io";
|
|
116
|
+
const iframeUrl = buildIframeUrl || config.services.iframeUrl || "https://auth.embarkai.io";
|
|
114
117
|
return iframeUrl;
|
|
115
118
|
}
|
|
116
119
|
function getBlockscoutApiUrl(chainConfig) {
|
|
@@ -144,7 +147,7 @@ var init_initial = __esm({
|
|
|
144
147
|
icon: TelegramIcon,
|
|
145
148
|
comingSoon: false,
|
|
146
149
|
meta: {
|
|
147
|
-
botUsername: "
|
|
150
|
+
botUsername: "embark_ai_bot",
|
|
148
151
|
salt: "demo"
|
|
149
152
|
}
|
|
150
153
|
}
|
|
@@ -178,8 +181,8 @@ var init_initial = __esm({
|
|
|
178
181
|
// Will fallback to build-time env vars
|
|
179
182
|
shareVaultUrl: "",
|
|
180
183
|
// Will fallback to build-time env vars
|
|
181
|
-
iframeUrl:
|
|
182
|
-
// Secure iframe for MPC operations
|
|
184
|
+
// iframeUrl: '',
|
|
185
|
+
// iframeUrl: 'https://auth.embarkai.io', // Secure iframe for MPC operations
|
|
183
186
|
tssRequireWasm: false,
|
|
184
187
|
tssWasmDebug: false
|
|
185
188
|
},
|
|
@@ -5167,7 +5170,7 @@ var init_button = __esm({
|
|
|
5167
5170
|
buttonVariants = (0, import_class_variance_authority.cva)(
|
|
5168
5171
|
cn(
|
|
5169
5172
|
"cursor-pointer py-0",
|
|
5170
|
-
"inline-flex items-center justify-center
|
|
5173
|
+
"inline-flex items-center justify-center",
|
|
5171
5174
|
"transition-all duration-200",
|
|
5172
5175
|
"disabled:cursor-default disabled:opacity-50",
|
|
5173
5176
|
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
@@ -5195,9 +5198,9 @@ var init_button = __esm({
|
|
|
5195
5198
|
)
|
|
5196
5199
|
},
|
|
5197
5200
|
size: {
|
|
5198
|
-
small: "h-6 px-2",
|
|
5199
|
-
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]",
|
|
5200
|
-
large: "h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]",
|
|
5201
|
+
small: "h-6 px-2 gap-2",
|
|
5202
|
+
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] gap-2",
|
|
5203
|
+
large: "h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] gap-[var(--ui-kit-gap)]",
|
|
5201
5204
|
icon: "h-8 w-8 p-0"
|
|
5202
5205
|
}
|
|
5203
5206
|
},
|
|
@@ -5401,7 +5404,7 @@ var init_en = __esm({
|
|
|
5401
5404
|
sender: "Sender",
|
|
5402
5405
|
bridgeAsset: "Bridge {{asset}}",
|
|
5403
5406
|
selectTokenAndRoute: "Select Token & Route",
|
|
5404
|
-
selectToken: "Select
|
|
5407
|
+
selectToken: "Select Asset",
|
|
5405
5408
|
estimations: "Estimations",
|
|
5406
5409
|
estimatedFee: "Estimated Fee",
|
|
5407
5410
|
availableChainPairs: "Available Chain Pairs",
|
|
@@ -7125,7 +7128,7 @@ function Social(props) {
|
|
|
7125
7128
|
};
|
|
7126
7129
|
let authConfig = provider?.meta || {};
|
|
7127
7130
|
if (normalizedProviderId === "telegram" && !authConfig.botUsername) {
|
|
7128
|
-
const defaultBotUsername = "
|
|
7131
|
+
const defaultBotUsername = "embark_ai_bot";
|
|
7129
7132
|
if (defaultBotUsername) {
|
|
7130
7133
|
authConfig = { ...authConfig, botUsername: defaultBotUsername };
|
|
7131
7134
|
}
|
|
@@ -10251,11 +10254,8 @@ async function getEstimates(payload) {
|
|
|
10251
10254
|
}
|
|
10252
10255
|
async function createWidgetUrlMutation(payload) {
|
|
10253
10256
|
const { iframeManager, accessToken } = iframe2();
|
|
10254
|
-
const
|
|
10255
|
-
|
|
10256
|
-
accessToken
|
|
10257
|
-
});
|
|
10258
|
-
return widgetUrlData;
|
|
10257
|
+
const response = await iframeManager.sendMessage("FINCHPAY_GET_WIDGET_URL_QUERY", { accessToken, payload });
|
|
10258
|
+
return response;
|
|
10259
10259
|
}
|
|
10260
10260
|
async function getTransactionList2(payload) {
|
|
10261
10261
|
const { iframeManager, accessToken } = iframe2();
|
|
@@ -13556,13 +13556,26 @@ async function beginPasskeyLinking() {
|
|
|
13556
13556
|
const begin2 = await res.json();
|
|
13557
13557
|
const options2 = {
|
|
13558
13558
|
rp: begin2.rp,
|
|
13559
|
-
user: {
|
|
13559
|
+
user: {
|
|
13560
|
+
id: base64urlToUint8Array(begin2.user.id),
|
|
13561
|
+
name: begin2.user.name,
|
|
13562
|
+
displayName: begin2.user.displayName
|
|
13563
|
+
},
|
|
13560
13564
|
challenge: base64urlToUint8Array(begin2.challenge),
|
|
13561
13565
|
pubKeyCredParams: begin2.pubKeyCredParams,
|
|
13562
13566
|
timeout: begin2.timeout,
|
|
13563
13567
|
attestation: begin2.attestation,
|
|
13564
|
-
authenticatorSelection: {
|
|
13565
|
-
|
|
13568
|
+
authenticatorSelection: {
|
|
13569
|
+
...begin2.authenticatorSelection,
|
|
13570
|
+
residentKey: begin2.authenticatorSelection?.residentKey ?? "preferred",
|
|
13571
|
+
requireResidentKey: begin2.authenticatorSelection?.requireResidentKey ?? false,
|
|
13572
|
+
userVerification: begin2.authenticatorSelection?.userVerification ?? "preferred"
|
|
13573
|
+
},
|
|
13574
|
+
excludeCredentials: begin2.excludeCredentials?.map((cred) => ({
|
|
13575
|
+
type: cred.type,
|
|
13576
|
+
id: base64urlToUint8Array(cred.id),
|
|
13577
|
+
transports: cred.transports
|
|
13578
|
+
})) || void 0
|
|
13566
13579
|
};
|
|
13567
13580
|
return { challengeId: begin2.challengeId, options: options2 };
|
|
13568
13581
|
}
|
|
@@ -13571,13 +13584,26 @@ async function beginPasskeyLinking() {
|
|
|
13571
13584
|
const begin = await res.json();
|
|
13572
13585
|
const options = {
|
|
13573
13586
|
rp: begin.rp,
|
|
13574
|
-
user: {
|
|
13587
|
+
user: {
|
|
13588
|
+
id: base64urlToUint8Array(begin.user.id),
|
|
13589
|
+
name: begin.user.name,
|
|
13590
|
+
displayName: begin.user.displayName
|
|
13591
|
+
},
|
|
13575
13592
|
challenge: base64urlToUint8Array(begin.challenge),
|
|
13576
13593
|
pubKeyCredParams: begin.pubKeyCredParams,
|
|
13577
13594
|
timeout: begin.timeout,
|
|
13578
13595
|
attestation: begin.attestation,
|
|
13579
|
-
authenticatorSelection: {
|
|
13580
|
-
|
|
13596
|
+
authenticatorSelection: {
|
|
13597
|
+
...begin.authenticatorSelection,
|
|
13598
|
+
residentKey: "preferred",
|
|
13599
|
+
requireResidentKey: false,
|
|
13600
|
+
userVerification: "preferred"
|
|
13601
|
+
},
|
|
13602
|
+
excludeCredentials: begin.excludeCredentials?.map((cred) => ({
|
|
13603
|
+
type: cred.type,
|
|
13604
|
+
id: base64urlToUint8Array(cred.id),
|
|
13605
|
+
transports: cred.transports
|
|
13606
|
+
})) || void 0
|
|
13581
13607
|
};
|
|
13582
13608
|
return { challengeId: begin.challengeId, options };
|
|
13583
13609
|
}
|
|
@@ -13615,7 +13641,7 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
13615
13641
|
try {
|
|
13616
13642
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
13617
13643
|
const friendlyDisplay = `EmbarkAI Wallet (${ts})`;
|
|
13618
|
-
const friendlyName = `
|
|
13644
|
+
const friendlyName = `embarkai.${ts}`;
|
|
13619
13645
|
const originalUser = publicKeyOptions.user;
|
|
13620
13646
|
publicKeyOptions = {
|
|
13621
13647
|
...publicKeyOptions,
|
|
@@ -13645,7 +13671,9 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
13645
13671
|
timeout: publicKeyOptions.timeout,
|
|
13646
13672
|
attestation: publicKeyOptions.attestation
|
|
13647
13673
|
});
|
|
13648
|
-
const credential = await navigator.credentials.create({
|
|
13674
|
+
const credential = await navigator.credentials.create({
|
|
13675
|
+
publicKey: { ...publicKeyOptions, ...optionsOverride }
|
|
13676
|
+
});
|
|
13649
13677
|
if (!credential) throw new Error("Passkey creation was cancelled");
|
|
13650
13678
|
const attestationPayload = credentialToAttestationPayload(credential);
|
|
13651
13679
|
const cid = challengeId || "local-" + Date.now();
|
|
@@ -13655,8 +13683,8 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
13655
13683
|
}
|
|
13656
13684
|
var init_passkey2 = __esm({
|
|
13657
13685
|
"src/internal/auth/providers/passkey.ts"() {
|
|
13658
|
-
init_auth();
|
|
13659
13686
|
init_base64url();
|
|
13687
|
+
init_auth();
|
|
13660
13688
|
init_webauthn();
|
|
13661
13689
|
init_types();
|
|
13662
13690
|
}
|
|
@@ -15571,12 +15599,11 @@ async function fetchToken(params = {}) {
|
|
|
15571
15599
|
if (!token) throw new Error("Invalid Sumsub token response");
|
|
15572
15600
|
return token;
|
|
15573
15601
|
}
|
|
15574
|
-
var DEFAULT_TTL_SECONDS
|
|
15602
|
+
var DEFAULT_TTL_SECONDS;
|
|
15575
15603
|
var init_sumsub = __esm({
|
|
15576
15604
|
"src/internal/components/KYC/api/sumsub.ts"() {
|
|
15577
15605
|
init_httpClient();
|
|
15578
15606
|
DEFAULT_TTL_SECONDS = 600;
|
|
15579
|
-
QUERY_KEYS3 = { sumsubToken: "sumsub-token" };
|
|
15580
15607
|
}
|
|
15581
15608
|
});
|
|
15582
15609
|
|
|
@@ -15650,7 +15677,6 @@ var init_SumsubIframeManager = __esm({
|
|
|
15650
15677
|
// src/internal/components/KYC/useSumsubIframe.ts
|
|
15651
15678
|
function useSumsubIframe({ iframeUrl }) {
|
|
15652
15679
|
const config = useProviderConfig().config;
|
|
15653
|
-
const qc = (0, import_react_query24.useQueryClient)();
|
|
15654
15680
|
const { colorMode } = useColorMode();
|
|
15655
15681
|
const iframeRef = (0, import_react46.useRef)(null);
|
|
15656
15682
|
const [isLoading, setIsLoading] = (0, import_react46.useState)(true);
|
|
@@ -15671,15 +15697,9 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
15671
15697
|
iframeOrigin,
|
|
15672
15698
|
getToken: () => {
|
|
15673
15699
|
setStatus("Authenticating...");
|
|
15674
|
-
return
|
|
15675
|
-
queryKey: [QUERY_KEYS3.sumsubToken, levelName],
|
|
15676
|
-
queryFn: () => fetchToken({ levelName })
|
|
15677
|
-
});
|
|
15678
|
-
},
|
|
15679
|
-
refreshToken: async () => {
|
|
15680
|
-
const queryKey = [QUERY_KEYS3.sumsubToken, levelName];
|
|
15681
|
-
return qc.fetchQuery({ queryKey, queryFn: () => fetchToken({ levelName }) });
|
|
15700
|
+
return fetchToken({ levelName });
|
|
15682
15701
|
},
|
|
15702
|
+
refreshToken: () => fetchToken({ levelName }),
|
|
15683
15703
|
onSdkBuilt: () => setStatus("Loading verification form..."),
|
|
15684
15704
|
sendMessage: (msg) => iframeRef.current?.contentWindow?.postMessage(msg, iframeOrigin),
|
|
15685
15705
|
onReady: () => {
|
|
@@ -15705,12 +15725,11 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
15705
15725
|
status
|
|
15706
15726
|
};
|
|
15707
15727
|
}
|
|
15708
|
-
var
|
|
15728
|
+
var import_react46;
|
|
15709
15729
|
var init_useSumsubIframe = __esm({
|
|
15710
15730
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
15711
15731
|
init_ProviderContext();
|
|
15712
15732
|
init_useColorMode();
|
|
15713
|
-
import_react_query24 = require("@tanstack/react-query");
|
|
15714
15733
|
import_react46 = require("react");
|
|
15715
15734
|
init_sumsub();
|
|
15716
15735
|
init_SumsubIframeManager();
|
|
@@ -15803,7 +15822,7 @@ var init_KycMenu = __esm({
|
|
|
15803
15822
|
// src/internal/components/KYC/KYCStatus.tsx
|
|
15804
15823
|
function KYCStatus() {
|
|
15805
15824
|
const address = useSession((st) => st.address);
|
|
15806
|
-
const { data: userProfile = null, isLoading: isUserProfileLoading } = (0,
|
|
15825
|
+
const { data: userProfile = null, isLoading: isUserProfileLoading } = (0, import_react_query24.useQuery)({
|
|
15807
15826
|
retry: false,
|
|
15808
15827
|
enabled: !!address,
|
|
15809
15828
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
@@ -15829,11 +15848,11 @@ function KYCStatus() {
|
|
|
15829
15848
|
)
|
|
15830
15849
|
] });
|
|
15831
15850
|
}
|
|
15832
|
-
var
|
|
15851
|
+
var import_react_query24, import_lucide_react39, import_jsx_runtime68;
|
|
15833
15852
|
var init_KYCStatus = __esm({
|
|
15834
15853
|
"src/internal/components/KYC/KYCStatus.tsx"() {
|
|
15835
15854
|
init_SessionContext();
|
|
15836
|
-
|
|
15855
|
+
import_react_query24 = require("@tanstack/react-query");
|
|
15837
15856
|
import_lucide_react39 = require("lucide-react");
|
|
15838
15857
|
init_PositiveIcon();
|
|
15839
15858
|
init_profile();
|
|
@@ -15960,7 +15979,7 @@ var init_common = __esm({
|
|
|
15960
15979
|
// src/internal/components/ManageWalletMenu/hooks/useProvidersList.ts
|
|
15961
15980
|
function useProvidersList() {
|
|
15962
15981
|
const address = useSession((st) => st.address);
|
|
15963
|
-
return (0,
|
|
15982
|
+
return (0, import_react_query25.useQuery)({
|
|
15964
15983
|
retry: false,
|
|
15965
15984
|
// hook is invoked on multiple pages to preload cache
|
|
15966
15985
|
enabled: !!address,
|
|
@@ -15969,11 +15988,11 @@ function useProvidersList() {
|
|
|
15969
15988
|
queryFn: async () => getLinkedProviders()
|
|
15970
15989
|
});
|
|
15971
15990
|
}
|
|
15972
|
-
var
|
|
15991
|
+
var import_react_query25, PROVIDERS_QUERY_KEY;
|
|
15973
15992
|
var init_useProvidersList = __esm({
|
|
15974
15993
|
"src/internal/components/ManageWalletMenu/hooks/useProvidersList.ts"() {
|
|
15975
15994
|
init_SessionContext();
|
|
15976
|
-
|
|
15995
|
+
import_react_query25 = require("@tanstack/react-query");
|
|
15977
15996
|
init_common();
|
|
15978
15997
|
PROVIDERS_QUERY_KEY = "lumia-passport-providers-query";
|
|
15979
15998
|
}
|
|
@@ -16047,13 +16066,13 @@ async function getLinkProfilesData() {
|
|
|
16047
16066
|
return { profiles: loadedProfiles, avatar };
|
|
16048
16067
|
}
|
|
16049
16068
|
function useLinkedProfiles() {
|
|
16050
|
-
const qc = (0,
|
|
16069
|
+
const qc = (0, import_react_query26.useQueryClient)();
|
|
16051
16070
|
const address = useSession((st) => st.address);
|
|
16052
16071
|
const {
|
|
16053
16072
|
data,
|
|
16054
16073
|
isFetching: isLoading,
|
|
16055
16074
|
error
|
|
16056
|
-
} = (0,
|
|
16075
|
+
} = (0, import_react_query26.useQuery)({
|
|
16057
16076
|
retry: false,
|
|
16058
16077
|
enabled: !!address,
|
|
16059
16078
|
queryKey: [LINKED_PROFILES_QUERY_KEY, address],
|
|
@@ -16065,10 +16084,10 @@ function useLinkedProfiles() {
|
|
|
16065
16084
|
}, [qc, address]);
|
|
16066
16085
|
return { profiles, avatar, isLoading, error, refresh };
|
|
16067
16086
|
}
|
|
16068
|
-
var
|
|
16087
|
+
var import_react_query26, import_react48, LINKED_PROFILES_QUERY_KEY;
|
|
16069
16088
|
var init_linkedProfiles = __esm({
|
|
16070
16089
|
"src/modules/linkedProfiles.ts"() {
|
|
16071
|
-
|
|
16090
|
+
import_react_query26 = require("@tanstack/react-query");
|
|
16072
16091
|
import_react48 = require("react");
|
|
16073
16092
|
init_SessionContext();
|
|
16074
16093
|
init_auth();
|
|
@@ -16113,7 +16132,7 @@ function EmailForm() {
|
|
|
16113
16132
|
const isLoading = useSession((st) => st.isLoading);
|
|
16114
16133
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
16115
16134
|
const { email, setEmail, setAlert, setEmailCodeExpiresIn, setEmailStep } = useManageWalletStore();
|
|
16116
|
-
const { mutate: onSendVerificationCode } = (0,
|
|
16135
|
+
const { mutate: onSendVerificationCode } = (0, import_react_query27.useMutation)({
|
|
16117
16136
|
mutationFn: async () => {
|
|
16118
16137
|
if (!email) return;
|
|
16119
16138
|
setIsLoading(true);
|
|
@@ -16198,14 +16217,14 @@ function EmailForm() {
|
|
|
16198
16217
|
)
|
|
16199
16218
|
] });
|
|
16200
16219
|
}
|
|
16201
|
-
var
|
|
16220
|
+
var import_react_query27, import_lucide_react42, import_jsx_runtime71;
|
|
16202
16221
|
var init_EmailForm = __esm({
|
|
16203
16222
|
"src/internal/components/ManageWalletMenu/EmailForm.tsx"() {
|
|
16204
16223
|
init_initial();
|
|
16205
16224
|
init_ProviderContext();
|
|
16206
16225
|
init_SessionContext();
|
|
16207
16226
|
init_i18n();
|
|
16208
|
-
|
|
16227
|
+
import_react_query27 = require("@tanstack/react-query");
|
|
16209
16228
|
import_lucide_react42 = require("lucide-react");
|
|
16210
16229
|
init_projectId();
|
|
16211
16230
|
init_button();
|
|
@@ -16253,7 +16272,7 @@ function useSendVerificationCode() {
|
|
|
16253
16272
|
const setAlert = useManageWalletStore((st) => st.setAlert);
|
|
16254
16273
|
const setLinkIsLoading = useManageWalletStore((st) => st.setLinkIsLoading);
|
|
16255
16274
|
const setEmailCodeExpiresIn = useManageWalletStore((st) => st.setEmailCodeExpiresIn);
|
|
16256
|
-
return (0,
|
|
16275
|
+
return (0, import_react_query28.useMutation)({
|
|
16257
16276
|
mutationFn: async (email) => {
|
|
16258
16277
|
if (!email) {
|
|
16259
16278
|
throw new Error("Email is required");
|
|
@@ -16274,10 +16293,10 @@ function useSendVerificationCode() {
|
|
|
16274
16293
|
}
|
|
16275
16294
|
});
|
|
16276
16295
|
}
|
|
16277
|
-
var
|
|
16296
|
+
var import_react_query28;
|
|
16278
16297
|
var init_useSendVerificationCode = __esm({
|
|
16279
16298
|
"src/internal/components/ManageWalletMenu/hooks/useSendVerificationCode.ts"() {
|
|
16280
|
-
|
|
16299
|
+
import_react_query28 = require("@tanstack/react-query");
|
|
16281
16300
|
init_email();
|
|
16282
16301
|
init_useStore();
|
|
16283
16302
|
}
|
|
@@ -16286,7 +16305,7 @@ var init_useSendVerificationCode = __esm({
|
|
|
16286
16305
|
// src/internal/components/ManageWalletMenu/hooks/useVerifyCode.ts
|
|
16287
16306
|
function useVerifyCode() {
|
|
16288
16307
|
const { callbacksRef } = useProviderConfig();
|
|
16289
|
-
const qc = (0,
|
|
16308
|
+
const qc = (0, import_react_query29.useQueryClient)();
|
|
16290
16309
|
const address = useSession((st) => st.address);
|
|
16291
16310
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
16292
16311
|
const {
|
|
@@ -16300,7 +16319,7 @@ function useVerifyCode() {
|
|
|
16300
16319
|
setLinkIsLoading,
|
|
16301
16320
|
setAlert
|
|
16302
16321
|
} = useManageWalletStore();
|
|
16303
|
-
return (0,
|
|
16322
|
+
return (0, import_react_query29.useMutation)({
|
|
16304
16323
|
mutationFn: async (codeToVerify) => {
|
|
16305
16324
|
const code = codeToVerify ?? emailCode;
|
|
16306
16325
|
if (!code) {
|
|
@@ -16338,13 +16357,13 @@ function useVerifyCode() {
|
|
|
16338
16357
|
}
|
|
16339
16358
|
});
|
|
16340
16359
|
}
|
|
16341
|
-
var
|
|
16360
|
+
var import_react_query29;
|
|
16342
16361
|
var init_useVerifyCode = __esm({
|
|
16343
16362
|
"src/internal/components/ManageWalletMenu/hooks/useVerifyCode.ts"() {
|
|
16344
16363
|
init_ProviderContext();
|
|
16345
16364
|
init_SessionContext();
|
|
16346
16365
|
init_linkedProfiles();
|
|
16347
|
-
|
|
16366
|
+
import_react_query29 = require("@tanstack/react-query");
|
|
16348
16367
|
init_email();
|
|
16349
16368
|
init_useProvidersList();
|
|
16350
16369
|
init_useStore();
|
|
@@ -16363,7 +16382,7 @@ function normalizePasskeyLinkError(msg) {
|
|
|
16363
16382
|
return msg;
|
|
16364
16383
|
}
|
|
16365
16384
|
function AddProvider() {
|
|
16366
|
-
const qc = (0,
|
|
16385
|
+
const qc = (0, import_react_query30.useQueryClient)();
|
|
16367
16386
|
const { callbacksRef } = useProviderConfig();
|
|
16368
16387
|
const address = useSession((st) => st.address);
|
|
16369
16388
|
const { t } = useT();
|
|
@@ -16492,14 +16511,14 @@ function AddProvider() {
|
|
|
16492
16511
|
] })
|
|
16493
16512
|
] });
|
|
16494
16513
|
}
|
|
16495
|
-
var
|
|
16514
|
+
var import_react_query30, import_jsx_runtime72;
|
|
16496
16515
|
var init_AddProvider = __esm({
|
|
16497
16516
|
"src/internal/components/ManageWalletMenu/AddProvider.tsx"() {
|
|
16498
16517
|
init_ProviderContext();
|
|
16499
16518
|
init_SessionContext();
|
|
16500
16519
|
init_i18n();
|
|
16501
16520
|
init_linkedProfiles();
|
|
16502
|
-
|
|
16521
|
+
import_react_query30 = require("@tanstack/react-query");
|
|
16503
16522
|
init_PasskeyAddIcon();
|
|
16504
16523
|
init_passkey2();
|
|
16505
16524
|
init_useLayoutDataStore();
|
|
@@ -16551,7 +16570,7 @@ function normalizeSocialLinkError(message) {
|
|
|
16551
16570
|
return message;
|
|
16552
16571
|
}
|
|
16553
16572
|
function useLinkSocial() {
|
|
16554
|
-
const qc = (0,
|
|
16573
|
+
const qc = (0, import_react_query31.useQueryClient)();
|
|
16555
16574
|
const address = useSession((st) => st.address);
|
|
16556
16575
|
const {
|
|
16557
16576
|
config: { current: config },
|
|
@@ -16637,14 +16656,14 @@ function useLinkSocial() {
|
|
|
16637
16656
|
}
|
|
16638
16657
|
}, [providerType, linkIsLoading, socialLinkStarted, isWalletLinking, handleLinkSocialProvider]);
|
|
16639
16658
|
}
|
|
16640
|
-
var
|
|
16659
|
+
var import_react_query31, import_react49;
|
|
16641
16660
|
var init_useLinkSocial = __esm({
|
|
16642
16661
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16643
16662
|
init_useLayoutDataStore();
|
|
16644
16663
|
init_ProviderContext();
|
|
16645
16664
|
init_SessionContext();
|
|
16646
16665
|
init_linkedProfiles();
|
|
16647
|
-
|
|
16666
|
+
import_react_query31 = require("@tanstack/react-query");
|
|
16648
16667
|
import_react49 = __toESM(require("react"), 1);
|
|
16649
16668
|
init_auth();
|
|
16650
16669
|
init_telegramBrowser();
|
|
@@ -16709,7 +16728,7 @@ function useLinkTelegram() {
|
|
|
16709
16728
|
config: { current: config },
|
|
16710
16729
|
callbacksRef
|
|
16711
16730
|
} = useProviderConfig();
|
|
16712
|
-
const qc = (0,
|
|
16731
|
+
const qc = (0, import_react_query32.useQueryClient)();
|
|
16713
16732
|
const address = useSession((st) => st.address);
|
|
16714
16733
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16715
16734
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
@@ -16728,7 +16747,7 @@ function useLinkTelegram() {
|
|
|
16728
16747
|
);
|
|
16729
16748
|
let botUsername = telegramProvider?.meta?.botUsername;
|
|
16730
16749
|
if (!botUsername) {
|
|
16731
|
-
botUsername = "
|
|
16750
|
+
botUsername = "embark_ai_bot";
|
|
16732
16751
|
}
|
|
16733
16752
|
if (!botUsername) {
|
|
16734
16753
|
throw new Error("Telegram bot username not configured");
|
|
@@ -16785,13 +16804,13 @@ function useLinkTelegram() {
|
|
|
16785
16804
|
}
|
|
16786
16805
|
}, [providerType]);
|
|
16787
16806
|
}
|
|
16788
|
-
var
|
|
16807
|
+
var import_react_query32, import_react50;
|
|
16789
16808
|
var init_useLinkTelegram = __esm({
|
|
16790
16809
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16791
16810
|
init_ProviderContext();
|
|
16792
16811
|
init_SessionContext();
|
|
16793
16812
|
init_linkedProfiles();
|
|
16794
|
-
|
|
16813
|
+
import_react_query32 = require("@tanstack/react-query");
|
|
16795
16814
|
import_react50 = require("react");
|
|
16796
16815
|
init_telegram2();
|
|
16797
16816
|
init_useLayoutDataStore();
|
|
@@ -17085,14 +17104,14 @@ var init_ManageWallet = __esm({
|
|
|
17085
17104
|
|
|
17086
17105
|
// src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
|
|
17087
17106
|
function UnlinkProviderMenu() {
|
|
17088
|
-
const qc = (0,
|
|
17107
|
+
const qc = (0, import_react_query33.useQueryClient)();
|
|
17089
17108
|
const address = useSession((st) => st.address);
|
|
17090
17109
|
const { callbacksRef } = useProviderConfig();
|
|
17091
17110
|
const { t } = useT();
|
|
17092
17111
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17093
17112
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
17094
17113
|
const [confirmInput, setConfirmInput] = (0, import_react52.useState)("");
|
|
17095
|
-
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0,
|
|
17114
|
+
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query33.useMutation)({
|
|
17096
17115
|
mutationFn: async () => {
|
|
17097
17116
|
if (!confirmUnlink) {
|
|
17098
17117
|
throw new Error("No provider to unlink");
|
|
@@ -17166,7 +17185,7 @@ function UnlinkProviderMenu() {
|
|
|
17166
17185
|
] })
|
|
17167
17186
|
] });
|
|
17168
17187
|
}
|
|
17169
|
-
var
|
|
17188
|
+
var import_react_query33, import_lucide_react46, import_react52, import_jsx_runtime76;
|
|
17170
17189
|
var init_UnlinkProviderMenu = __esm({
|
|
17171
17190
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
17172
17191
|
init_useLayoutDataStore();
|
|
@@ -17174,7 +17193,7 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
17174
17193
|
init_SessionContext();
|
|
17175
17194
|
init_useT();
|
|
17176
17195
|
init_linkedProfiles();
|
|
17177
|
-
|
|
17196
|
+
import_react_query33 = require("@tanstack/react-query");
|
|
17178
17197
|
import_lucide_react46 = require("lucide-react");
|
|
17179
17198
|
import_react52 = require("react");
|
|
17180
17199
|
init_auth();
|
|
@@ -17329,7 +17348,7 @@ function NicknameEditForm(props) {
|
|
|
17329
17348
|
info
|
|
17330
17349
|
} = props;
|
|
17331
17350
|
const { handle: currentNickname, canChange } = info || { handle: "", canChange: false };
|
|
17332
|
-
const qc = (0,
|
|
17351
|
+
const qc = (0, import_react_query34.useQueryClient)();
|
|
17333
17352
|
const { t } = useT();
|
|
17334
17353
|
const passportWalletAddress = useSession((st) => st.address);
|
|
17335
17354
|
const { callbacksRef } = useProviderConfig();
|
|
@@ -17341,7 +17360,7 @@ function NicknameEditForm(props) {
|
|
|
17341
17360
|
isSuccess: isNicknameChangeSuccess,
|
|
17342
17361
|
// error: nicknameChangeError,
|
|
17343
17362
|
reset
|
|
17344
|
-
} = (0,
|
|
17363
|
+
} = (0, import_react_query34.useMutation)({
|
|
17345
17364
|
mutationFn: (handle) => changeNickname(handle),
|
|
17346
17365
|
onSuccess: () => {
|
|
17347
17366
|
qc.invalidateQueries({ queryKey: [QUERY_KEYS.nicknameInfo] });
|
|
@@ -17443,13 +17462,13 @@ function NicknameEditForm(props) {
|
|
|
17443
17462
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px]", children: t("passport:nicknameMenu.hint") })
|
|
17444
17463
|
] });
|
|
17445
17464
|
}
|
|
17446
|
-
var
|
|
17465
|
+
var import_react_query34, import_lucide_react48, import_react53, import_jsx_runtime78;
|
|
17447
17466
|
var init_NicknameEditForm = __esm({
|
|
17448
17467
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
17449
17468
|
init_ProviderContext();
|
|
17450
17469
|
init_SessionContext();
|
|
17451
17470
|
init_i18n();
|
|
17452
|
-
|
|
17471
|
+
import_react_query34 = require("@tanstack/react-query");
|
|
17453
17472
|
import_lucide_react48 = require("lucide-react");
|
|
17454
17473
|
import_react53 = require("react");
|
|
17455
17474
|
init_PositiveIcon();
|
|
@@ -17489,7 +17508,7 @@ function useNicknameForm(currentNickname) {
|
|
|
17489
17508
|
clearTimeout(timer);
|
|
17490
17509
|
};
|
|
17491
17510
|
}, [normalizedInputValue, isValidForCheck, shouldCheckAvailability]);
|
|
17492
|
-
const query = (0,
|
|
17511
|
+
const query = (0, import_react_query35.useQuery)({
|
|
17493
17512
|
retry: 1,
|
|
17494
17513
|
enabled: shouldCheckAvailability && isValidForCheck && queryInputValue.length > 0,
|
|
17495
17514
|
queryKey: QUERY_KEYS.nicknameAvailability(queryInputValue),
|
|
@@ -17506,10 +17525,10 @@ function useNicknameForm(currentNickname) {
|
|
|
17506
17525
|
availabilityQuery: query
|
|
17507
17526
|
};
|
|
17508
17527
|
}
|
|
17509
|
-
var
|
|
17528
|
+
var import_react_query35, import_react54, DEBOUNCE_MS;
|
|
17510
17529
|
var init_useNickname = __esm({
|
|
17511
17530
|
"src/internal/components/NicknameMenu/useNickname.ts"() {
|
|
17512
|
-
|
|
17531
|
+
import_react_query35 = require("@tanstack/react-query");
|
|
17513
17532
|
import_react54 = require("react");
|
|
17514
17533
|
init_nickname();
|
|
17515
17534
|
init_profile();
|
|
@@ -17529,7 +17548,7 @@ function NicknameMenu() {
|
|
|
17529
17548
|
data: nicknameInfo,
|
|
17530
17549
|
isLoading: isNicknameInfoLoading,
|
|
17531
17550
|
error: nicknameInfoError
|
|
17532
|
-
} = (0,
|
|
17551
|
+
} = (0, import_react_query36.useQuery)({
|
|
17533
17552
|
retry: 1,
|
|
17534
17553
|
enabled: !!address,
|
|
17535
17554
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
@@ -17609,12 +17628,12 @@ function NicknameMenu() {
|
|
|
17609
17628
|
}
|
|
17610
17629
|
);
|
|
17611
17630
|
}
|
|
17612
|
-
var
|
|
17631
|
+
var import_react_query36, import_dayjs4, import_lucide_react49, import_react55, import_jsx_runtime79;
|
|
17613
17632
|
var init_NicknameMenu = __esm({
|
|
17614
17633
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
17615
17634
|
init_SessionContext();
|
|
17616
17635
|
init_i18n();
|
|
17617
|
-
|
|
17636
|
+
import_react_query36 = require("@tanstack/react-query");
|
|
17618
17637
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
17619
17638
|
import_lucide_react49 = require("lucide-react");
|
|
17620
17639
|
import_react55 = require("react");
|
|
@@ -17640,24 +17659,68 @@ var init_NicknameMenu2 = __esm({
|
|
|
17640
17659
|
}
|
|
17641
17660
|
});
|
|
17642
17661
|
|
|
17662
|
+
// src/internal/hooks/useResolvedPublicClient.ts
|
|
17663
|
+
function getCachedPublicClient(chainId) {
|
|
17664
|
+
const cachedClient = publicClientByChainId.get(chainId);
|
|
17665
|
+
if (cachedClient) return cachedClient;
|
|
17666
|
+
const publicClient = (0, import_read13.createPublicClientForChain)(chainId);
|
|
17667
|
+
publicClientByChainId.set(chainId, publicClient);
|
|
17668
|
+
return publicClient;
|
|
17669
|
+
}
|
|
17670
|
+
function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient") {
|
|
17671
|
+
const activePublicClient = useSession((st) => st.publicClient);
|
|
17672
|
+
const activeChainId = useSession((st) => st.activeChainId);
|
|
17673
|
+
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
17674
|
+
const resolvedChainId = chainId ?? activeChainId;
|
|
17675
|
+
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17676
|
+
const chainConfig = (0, import_react56.useMemo)(() => {
|
|
17677
|
+
if (shouldUseActiveClient) return activeChainConfig;
|
|
17678
|
+
return (0, import_read13.getChainConfig)(chainId);
|
|
17679
|
+
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17680
|
+
const publicClient = (0, import_react56.useMemo)(() => {
|
|
17681
|
+
if (shouldUseActiveClient) return activePublicClient;
|
|
17682
|
+
if (!chainId) return activePublicClient;
|
|
17683
|
+
try {
|
|
17684
|
+
return getCachedPublicClient(chainId);
|
|
17685
|
+
} catch (error) {
|
|
17686
|
+
console.warn(`[${logScope}] Chain ${chainId} is not supported:`, error);
|
|
17687
|
+
return null;
|
|
17688
|
+
}
|
|
17689
|
+
}, [activePublicClient, chainId, logScope, shouldUseActiveClient]);
|
|
17690
|
+
return {
|
|
17691
|
+
activeChainId,
|
|
17692
|
+
chainConfig,
|
|
17693
|
+
publicClient,
|
|
17694
|
+
resolvedChainId
|
|
17695
|
+
};
|
|
17696
|
+
}
|
|
17697
|
+
var import_read13, import_react56, publicClientByChainId;
|
|
17698
|
+
var init_useResolvedPublicClient = __esm({
|
|
17699
|
+
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17700
|
+
init_SessionContext();
|
|
17701
|
+
import_read13 = require("@embarkai/core/read");
|
|
17702
|
+
import_react56 = require("react");
|
|
17703
|
+
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17704
|
+
}
|
|
17705
|
+
});
|
|
17706
|
+
|
|
17643
17707
|
// src/internal/hooks/useWatchTokens.ts
|
|
17644
17708
|
function useWatchTokens(options) {
|
|
17645
|
-
const { address, enabled = true } = options;
|
|
17709
|
+
const { address, chainId, enabled = true } = options;
|
|
17646
17710
|
const { config } = useProviderConfig();
|
|
17647
|
-
const publicClient =
|
|
17648
|
-
const
|
|
17649
|
-
const watchTokens = (0, import_react56.useMemo)(() => {
|
|
17711
|
+
const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
|
|
17712
|
+
const watchTokens = (0, import_react57.useMemo)(() => {
|
|
17650
17713
|
const allWatchTokens = config.current.watchTokens;
|
|
17651
|
-
const tokensForChain =
|
|
17714
|
+
const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
|
|
17652
17715
|
return tokensForChain;
|
|
17653
|
-
}, [config,
|
|
17716
|
+
}, [config, resolvedChainId]);
|
|
17654
17717
|
const {
|
|
17655
17718
|
data: assets,
|
|
17656
17719
|
isLoading,
|
|
17657
17720
|
error,
|
|
17658
17721
|
refetch
|
|
17659
|
-
} = (0,
|
|
17660
|
-
queryKey: [WATCH_TOKENS_QUERY_KEY,
|
|
17722
|
+
} = (0, import_react_query37.useQuery)({
|
|
17723
|
+
queryKey: [WATCH_TOKENS_QUERY_KEY, resolvedChainId, address, watchTokens.map((t) => t.address).join(",")],
|
|
17661
17724
|
queryFn: async () => {
|
|
17662
17725
|
if (!publicClient || !address || watchTokens.length === 0) {
|
|
17663
17726
|
return [];
|
|
@@ -17728,14 +17791,14 @@ function useWatchTokens(options) {
|
|
|
17728
17791
|
refetch
|
|
17729
17792
|
};
|
|
17730
17793
|
}
|
|
17731
|
-
var
|
|
17794
|
+
var import_react_query37, import_react57, import_viem6, WATCH_TOKENS_QUERY_KEY;
|
|
17732
17795
|
var init_useWatchTokens = __esm({
|
|
17733
17796
|
"src/internal/hooks/useWatchTokens.ts"() {
|
|
17734
17797
|
init_ProviderContext();
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
import_react56 = require("react");
|
|
17798
|
+
import_react_query37 = require("@tanstack/react-query");
|
|
17799
|
+
import_react57 = require("react");
|
|
17738
17800
|
import_viem6 = require("viem");
|
|
17801
|
+
init_useResolvedPublicClient();
|
|
17739
17802
|
WATCH_TOKENS_QUERY_KEY = "watch-tokens";
|
|
17740
17803
|
}
|
|
17741
17804
|
});
|
|
@@ -17865,30 +17928,28 @@ function createError(error) {
|
|
|
17865
17928
|
};
|
|
17866
17929
|
}
|
|
17867
17930
|
function useBlockscoutAssets(options) {
|
|
17868
|
-
const { address, enabled = true, detectSecurityTokens = true } = options;
|
|
17869
|
-
const publicClient =
|
|
17870
|
-
const activeChainId = useSession((st) => st.activeChainId);
|
|
17871
|
-
const chainConfig = useSession((st) => st.chainConfig);
|
|
17931
|
+
const { address, chainId, enabled = true, detectSecurityTokens = true } = options;
|
|
17932
|
+
const { chainConfig, publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useBlockscoutAssets");
|
|
17872
17933
|
const portfolioConfig = useProviderConfig().config.current.portfolio;
|
|
17873
17934
|
const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
|
|
17874
17935
|
const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
|
|
17875
17936
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
17876
|
-
const blockscoutClient = (0,
|
|
17937
|
+
const blockscoutClient = (0, import_react58.useMemo)(
|
|
17877
17938
|
() => blockscoutApiUrl ? (0, import_clients2.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
17878
17939
|
[blockscoutApiUrl]
|
|
17879
17940
|
);
|
|
17880
|
-
const lastRefreshRef = (0,
|
|
17941
|
+
const lastRefreshRef = (0, import_react58.useRef)(0);
|
|
17881
17942
|
const {
|
|
17882
17943
|
assets: watchTokenAssets,
|
|
17883
17944
|
isLoading: watchTokensLoading,
|
|
17884
17945
|
refetch: refetchWatchTokens
|
|
17885
|
-
} = useWatchTokens({ address, enabled });
|
|
17946
|
+
} = useWatchTokens({ address, chainId: resolvedChainId, enabled });
|
|
17886
17947
|
const {
|
|
17887
17948
|
data: nativeBalanceData,
|
|
17888
17949
|
isLoading: nativeLoading,
|
|
17889
17950
|
refetch: refetchNative
|
|
17890
|
-
} = (0,
|
|
17891
|
-
queryKey: ["native-balance",
|
|
17951
|
+
} = (0, import_react_query38.useQuery)({
|
|
17952
|
+
queryKey: ["native-balance", resolvedChainId, address],
|
|
17892
17953
|
queryFn: async () => {
|
|
17893
17954
|
if (!publicClient || !address) return null;
|
|
17894
17955
|
const balance = await publicClient.getBalance({ address });
|
|
@@ -17912,8 +17973,8 @@ function useBlockscoutAssets(options) {
|
|
|
17912
17973
|
error: tokensError,
|
|
17913
17974
|
refetch: refetchTokens,
|
|
17914
17975
|
dataUpdatedAt
|
|
17915
|
-
} = (0,
|
|
17916
|
-
queryKey: [BLOCKSCOUT_QUERY_KEY, address, blockscoutApiUrl, customTokenBalancesQueryKey],
|
|
17976
|
+
} = (0, import_react_query38.useQuery)({
|
|
17977
|
+
queryKey: [BLOCKSCOUT_QUERY_KEY, resolvedChainId, address, blockscoutApiUrl, customTokenBalancesQueryKey],
|
|
17917
17978
|
queryFn: async () => {
|
|
17918
17979
|
if (customTokenBalancesQuery) {
|
|
17919
17980
|
try {
|
|
@@ -17936,8 +17997,8 @@ function useBlockscoutAssets(options) {
|
|
|
17936
17997
|
data: nftItems,
|
|
17937
17998
|
isLoading: nftsLoading,
|
|
17938
17999
|
refetch: refetchNfts
|
|
17939
|
-
} = (0,
|
|
17940
|
-
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", address, blockscoutApiUrl],
|
|
18000
|
+
} = (0, import_react_query38.useQuery)({
|
|
18001
|
+
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
|
|
17941
18002
|
queryFn: () => blockscoutClient.getNfts(address),
|
|
17942
18003
|
enabled: !!address && enabled && !!blockscoutClient,
|
|
17943
18004
|
staleTime: BLOCKSCOUT_QUERY_STALE_TIME,
|
|
@@ -17946,12 +18007,12 @@ function useBlockscoutAssets(options) {
|
|
|
17946
18007
|
retry: 2,
|
|
17947
18008
|
retryDelay: 1e3
|
|
17948
18009
|
});
|
|
17949
|
-
const erc20TokenAddresses = (0,
|
|
18010
|
+
const erc20TokenAddresses = (0, import_react58.useMemo)(() => {
|
|
17950
18011
|
if (!tokenBalances) return [];
|
|
17951
18012
|
return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17952
18013
|
}, [tokenBalances]);
|
|
17953
|
-
const { data: erc3643Results } = (0,
|
|
17954
|
-
queryKey: [ERC3643_DETECTION_QUERY_KEY, address, erc20TokenAddresses],
|
|
18014
|
+
const { data: erc3643Results } = (0, import_react_query38.useQuery)({
|
|
18015
|
+
queryKey: [ERC3643_DETECTION_QUERY_KEY, resolvedChainId, address, erc20TokenAddresses],
|
|
17955
18016
|
queryFn: async () => {
|
|
17956
18017
|
if (!publicClient || erc20TokenAddresses.length === 0) {
|
|
17957
18018
|
return /* @__PURE__ */ new Map();
|
|
@@ -17990,7 +18051,7 @@ function useBlockscoutAssets(options) {
|
|
|
17990
18051
|
gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
17991
18052
|
retry: 1
|
|
17992
18053
|
});
|
|
17993
|
-
const assets = (0,
|
|
18054
|
+
const assets = (0, import_react58.useMemo)(() => {
|
|
17994
18055
|
const result = [];
|
|
17995
18056
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
17996
18057
|
if (nativeBalanceData) {
|
|
@@ -18036,7 +18097,7 @@ function useBlockscoutAssets(options) {
|
|
|
18036
18097
|
}
|
|
18037
18098
|
return result;
|
|
18038
18099
|
}, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
|
|
18039
|
-
const nativeBalance = (0,
|
|
18100
|
+
const nativeBalance = (0, import_react58.useMemo)(() => {
|
|
18040
18101
|
if (!nativeBalanceData) return null;
|
|
18041
18102
|
return {
|
|
18042
18103
|
value: nativeBalanceData.value,
|
|
@@ -18044,11 +18105,11 @@ function useBlockscoutAssets(options) {
|
|
|
18044
18105
|
symbol: nativeBalanceData.symbol
|
|
18045
18106
|
};
|
|
18046
18107
|
}, [nativeBalanceData]);
|
|
18047
|
-
const error = (0,
|
|
18108
|
+
const error = (0, import_react58.useMemo)(() => {
|
|
18048
18109
|
if (!tokensError) return null;
|
|
18049
18110
|
return createError(tokensError);
|
|
18050
18111
|
}, [tokensError]);
|
|
18051
|
-
const refreshBalances = (0,
|
|
18112
|
+
const refreshBalances = (0, import_react58.useCallback)(async () => {
|
|
18052
18113
|
const now = Date.now();
|
|
18053
18114
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
18054
18115
|
return;
|
|
@@ -18056,7 +18117,7 @@ function useBlockscoutAssets(options) {
|
|
|
18056
18117
|
lastRefreshRef.current = now;
|
|
18057
18118
|
await Promise.all([refetchNative(), refetchTokens(), refetchNfts(), refetchWatchTokens()]);
|
|
18058
18119
|
}, [refetchNative, refetchTokens, refetchNfts, refetchWatchTokens]);
|
|
18059
|
-
const getTokenBalance = (0,
|
|
18120
|
+
const getTokenBalance = (0, import_react58.useCallback)(
|
|
18060
18121
|
(tokenAddress) => {
|
|
18061
18122
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
18062
18123
|
},
|
|
@@ -18074,17 +18135,17 @@ function useBlockscoutAssets(options) {
|
|
|
18074
18135
|
lastUpdated: dataUpdatedAt || null
|
|
18075
18136
|
};
|
|
18076
18137
|
}
|
|
18077
|
-
var import_clients2,
|
|
18138
|
+
var import_clients2, import_react_query38, import_react58, import_viem7, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
|
|
18078
18139
|
var init_useBlockscoutAssets = __esm({
|
|
18079
18140
|
"src/internal/hooks/useBlockscoutAssets.ts"() {
|
|
18080
18141
|
init_ProviderContext();
|
|
18081
|
-
init_SessionContext();
|
|
18082
18142
|
import_clients2 = require("@embarkai/core/clients");
|
|
18083
|
-
|
|
18084
|
-
|
|
18143
|
+
import_react_query38 = require("@tanstack/react-query");
|
|
18144
|
+
import_react58 = require("react");
|
|
18085
18145
|
import_viem7 = require("viem");
|
|
18086
18146
|
init_initial();
|
|
18087
18147
|
init_constants();
|
|
18148
|
+
init_useResolvedPublicClient();
|
|
18088
18149
|
init_useWatchTokens();
|
|
18089
18150
|
BLOCKSCOUT_QUERY_KEY = "blockscout-token-balances";
|
|
18090
18151
|
ERC3643_DETECTION_QUERY_KEY = "erc3643-detection";
|
|
@@ -18197,8 +18258,8 @@ async function resolveAssetRate(symbol, address, customAssetRateQuery) {
|
|
|
18197
18258
|
}
|
|
18198
18259
|
function PortfolioItemImage(props) {
|
|
18199
18260
|
const { asset } = props;
|
|
18200
|
-
const [nftImageError, setNftImageError] = (0,
|
|
18201
|
-
const [logoError, setLogoError] = (0,
|
|
18261
|
+
const [nftImageError, setNftImageError] = (0, import_react59.useState)(false);
|
|
18262
|
+
const [logoError, setLogoError] = (0, import_react59.useState)(false);
|
|
18202
18263
|
const isNft = isNftAsset(asset);
|
|
18203
18264
|
const nftImage = getNftImage(asset);
|
|
18204
18265
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -18239,14 +18300,14 @@ function PortfolioItem(props) {
|
|
|
18239
18300
|
const { assets: projectAssets, showBalanceAs: showBalanceAsSymbol } = providerConfig.projectAssets || {};
|
|
18240
18301
|
const customAssetRateQuery = providerConfig.portfolio?.assetRateQuery;
|
|
18241
18302
|
const customAssetRateQueryKey = providerConfig.portfolio?.assetRateQueryKey;
|
|
18242
|
-
const qc = (0,
|
|
18303
|
+
const qc = (0, import_react_query39.useQueryClient)();
|
|
18243
18304
|
const { balanceQueryKey } = projectAssets?.find((a) => a.symbol === showBalanceAsSymbol) || {};
|
|
18244
18305
|
const projectAssetBalance = !!balanceQueryKey ? qc.getQueryData(balanceQueryKey) : null;
|
|
18245
18306
|
const isNft = isNftAsset(asset);
|
|
18246
18307
|
const isSecurity = isSecurityToken(asset);
|
|
18247
18308
|
const embeddedRate = Number(asset.exchangeRateUsd || 0);
|
|
18248
18309
|
const hasEmbeddedRate = Number.isFinite(embeddedRate) && embeddedRate > 0;
|
|
18249
|
-
const { data: assetRate, isLoading: isRateLoading } = (0,
|
|
18310
|
+
const { data: assetRate, isLoading: isRateLoading } = (0, import_react_query39.useQuery)({
|
|
18250
18311
|
retry: false,
|
|
18251
18312
|
staleTime: 4 * 60 * 1e3,
|
|
18252
18313
|
enabled: !!address && !hasEmbeddedRate && !isProjectAsset && !isNft && !isSecurity && (!!customAssetRateQuery || !!isAssetRateAvailable(asset.symbol)),
|
|
@@ -18317,14 +18378,14 @@ function PortfolioItem(props) {
|
|
|
18317
18378
|
}
|
|
18318
18379
|
);
|
|
18319
18380
|
}
|
|
18320
|
-
var
|
|
18381
|
+
var import_react_query39, import_lucide_react50, import_react59, import_viem9, import_jsx_runtime81, SKIP_SYMBOLS2, ASSETS_RATES_QUERY_KEY;
|
|
18321
18382
|
var init_PortfolioItem = __esm({
|
|
18322
18383
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
18323
18384
|
init_ProviderContext();
|
|
18324
18385
|
init_tokens();
|
|
18325
|
-
|
|
18386
|
+
import_react_query39 = require("@tanstack/react-query");
|
|
18326
18387
|
import_lucide_react50 = require("lucide-react");
|
|
18327
|
-
|
|
18388
|
+
import_react59 = require("react");
|
|
18328
18389
|
import_viem9 = require("viem");
|
|
18329
18390
|
init_base();
|
|
18330
18391
|
init_priceFormatter();
|
|
@@ -18341,7 +18402,7 @@ var init_PortfolioItem = __esm({
|
|
|
18341
18402
|
function PortfolioMenu() {
|
|
18342
18403
|
const { assets: projectAssets = [] } = useProviderConfig().config.current?.projectAssets || {};
|
|
18343
18404
|
const { t } = useT();
|
|
18344
|
-
const qc = (0,
|
|
18405
|
+
const qc = (0, import_react_query40.useQueryClient)();
|
|
18345
18406
|
const address = useSession((st) => st.address);
|
|
18346
18407
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
18347
18408
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
@@ -18356,7 +18417,7 @@ function PortfolioMenu() {
|
|
|
18356
18417
|
enabled: !!address
|
|
18357
18418
|
});
|
|
18358
18419
|
const shownProjectAssests = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18359
|
-
const refreshAllAssetsBalances = (0,
|
|
18420
|
+
const refreshAllAssetsBalances = (0, import_react60.useCallback)(() => {
|
|
18360
18421
|
Promise.all(shownProjectAssests.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18361
18422
|
refreshBlockscoutBalances();
|
|
18362
18423
|
}, [qc, shownProjectAssests, refreshBlockscoutBalances]);
|
|
@@ -18406,15 +18467,15 @@ function PortfolioMenu() {
|
|
|
18406
18467
|
}
|
|
18407
18468
|
);
|
|
18408
18469
|
}
|
|
18409
|
-
var
|
|
18470
|
+
var import_react_query40, import_lucide_react51, import_react60, import_jsx_runtime82;
|
|
18410
18471
|
var init_PortfolioMenu = __esm({
|
|
18411
18472
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
18412
18473
|
init_ProviderContext();
|
|
18413
18474
|
init_SessionContext();
|
|
18414
18475
|
init_i18n();
|
|
18415
|
-
|
|
18476
|
+
import_react_query40 = require("@tanstack/react-query");
|
|
18416
18477
|
import_lucide_react51 = require("lucide-react");
|
|
18417
|
-
|
|
18478
|
+
import_react60 = require("react");
|
|
18418
18479
|
init_useBlockscoutAssets();
|
|
18419
18480
|
init_useLayoutDataStore();
|
|
18420
18481
|
init_useLayoutStore();
|
|
@@ -18523,10 +18584,10 @@ function ReceiveMenu() {
|
|
|
18523
18584
|
const { t } = useT();
|
|
18524
18585
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18525
18586
|
const open = page === "receive";
|
|
18526
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
18527
|
-
const [copied, setCopied] = (0,
|
|
18528
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
18529
|
-
const fingerprint = (0,
|
|
18587
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react61.useState)("");
|
|
18588
|
+
const [copied, setCopied] = (0, import_react61.useState)(false);
|
|
18589
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react61.useState)(false);
|
|
18590
|
+
const fingerprint = (0, import_react61.useMemo)(() => {
|
|
18530
18591
|
if (!session?.ownerAddress) return null;
|
|
18531
18592
|
try {
|
|
18532
18593
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -18534,7 +18595,7 @@ function ReceiveMenu() {
|
|
|
18534
18595
|
return null;
|
|
18535
18596
|
}
|
|
18536
18597
|
}, [session?.ownerAddress]);
|
|
18537
|
-
(0,
|
|
18598
|
+
(0, import_react61.useEffect)(() => {
|
|
18538
18599
|
if (open && address) {
|
|
18539
18600
|
import_qrcode.default.toDataURL(address, {
|
|
18540
18601
|
width: 200,
|
|
@@ -18547,7 +18608,7 @@ function ReceiveMenu() {
|
|
|
18547
18608
|
});
|
|
18548
18609
|
}
|
|
18549
18610
|
}, [open, address]);
|
|
18550
|
-
const handleCopy = (0,
|
|
18611
|
+
const handleCopy = (0, import_react61.useCallback)(async () => {
|
|
18551
18612
|
if (!address) return;
|
|
18552
18613
|
try {
|
|
18553
18614
|
await navigator.clipboard.writeText(address);
|
|
@@ -18557,7 +18618,7 @@ function ReceiveMenu() {
|
|
|
18557
18618
|
console.error("Failed to copy address:", error);
|
|
18558
18619
|
}
|
|
18559
18620
|
}, [address]);
|
|
18560
|
-
const handleCopyFingerprint = (0,
|
|
18621
|
+
const handleCopyFingerprint = (0, import_react61.useCallback)(async () => {
|
|
18561
18622
|
if (!fingerprint) return;
|
|
18562
18623
|
try {
|
|
18563
18624
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18618,14 +18679,14 @@ function ReceiveMenu() {
|
|
|
18618
18679
|
}
|
|
18619
18680
|
);
|
|
18620
18681
|
}
|
|
18621
|
-
var import_lucide_react52, import_qrcode,
|
|
18682
|
+
var import_lucide_react52, import_qrcode, import_react61, import_jsx_runtime83;
|
|
18622
18683
|
var init_ReceiveMenu = __esm({
|
|
18623
18684
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
18624
18685
|
init_SessionContext();
|
|
18625
18686
|
init_i18n();
|
|
18626
18687
|
import_lucide_react52 = require("lucide-react");
|
|
18627
18688
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
18628
|
-
|
|
18689
|
+
import_react61 = require("react");
|
|
18629
18690
|
init_useLayoutDataStore();
|
|
18630
18691
|
init_useLayoutStore();
|
|
18631
18692
|
init_nickname_fingerprint();
|
|
@@ -18661,7 +18722,7 @@ var init_constants6 = __esm({
|
|
|
18661
18722
|
function useConnectedApps() {
|
|
18662
18723
|
const session = useSession((st) => st.session);
|
|
18663
18724
|
const userId = session?.mpcUserId || null;
|
|
18664
|
-
return (0,
|
|
18725
|
+
return (0, import_react_query41.useQuery)({
|
|
18665
18726
|
retry: false,
|
|
18666
18727
|
enabled: !!userId,
|
|
18667
18728
|
queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId],
|
|
@@ -18677,7 +18738,7 @@ function useConnectedApps() {
|
|
|
18677
18738
|
function useKeyshareRecoveryStats() {
|
|
18678
18739
|
const session = useSession((st) => st.session);
|
|
18679
18740
|
const userId = session?.mpcUserId || null;
|
|
18680
|
-
return (0,
|
|
18741
|
+
return (0, import_react_query41.useQuery)({
|
|
18681
18742
|
enabled: !!userId,
|
|
18682
18743
|
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18683
18744
|
queryFn: async () => {
|
|
@@ -18694,11 +18755,11 @@ function useKeyshareRecoveryStats() {
|
|
|
18694
18755
|
}
|
|
18695
18756
|
});
|
|
18696
18757
|
}
|
|
18697
|
-
var
|
|
18758
|
+
var import_react_query41;
|
|
18698
18759
|
var init_hooks2 = __esm({
|
|
18699
18760
|
"src/internal/components/SecurityMenu/hooks.ts"() {
|
|
18700
18761
|
init_SessionContext();
|
|
18701
|
-
|
|
18762
|
+
import_react_query41 = require("@tanstack/react-query");
|
|
18702
18763
|
init_keyshare();
|
|
18703
18764
|
init_httpClient();
|
|
18704
18765
|
init_iframe_manager();
|
|
@@ -19093,17 +19154,17 @@ var init_UntrustApplication = __esm({
|
|
|
19093
19154
|
|
|
19094
19155
|
// src/internal/components/SecurityMenu/SecurityMenu.tsx
|
|
19095
19156
|
function SecurityMenu() {
|
|
19096
|
-
const qc = (0,
|
|
19157
|
+
const qc = (0, import_react_query42.useQueryClient)();
|
|
19097
19158
|
const { t } = useT();
|
|
19098
19159
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
19099
19160
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
19100
19161
|
const userId = import_auth21.jwtTokenManager.getUserId();
|
|
19101
19162
|
const serverHasKeyshare = import_auth21.jwtTokenManager.getHasKeyshare() ?? false;
|
|
19102
|
-
const [appToUntrust, untrustApp] = (0,
|
|
19163
|
+
const [appToUntrust, untrustApp] = (0, import_react62.useState)(null);
|
|
19103
19164
|
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
19104
19165
|
const localInfo = recoveryData?.keyshareInfo || {};
|
|
19105
19166
|
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
19106
|
-
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = (0,
|
|
19167
|
+
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = (0, import_react_query42.useMutation)({
|
|
19107
19168
|
mutationFn: async () => {
|
|
19108
19169
|
if (!userId || !appToUntrust) return;
|
|
19109
19170
|
const iframeManager = getIframeManager();
|
|
@@ -19175,13 +19236,13 @@ function SecurityMenu() {
|
|
|
19175
19236
|
}
|
|
19176
19237
|
);
|
|
19177
19238
|
}
|
|
19178
|
-
var
|
|
19239
|
+
var import_react_query42, import_lucide_react58, import_react62, import_jsx_runtime90;
|
|
19179
19240
|
var init_SecurityMenu = __esm({
|
|
19180
19241
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
19181
19242
|
init_i18n();
|
|
19182
|
-
|
|
19243
|
+
import_react_query42 = require("@tanstack/react-query");
|
|
19183
19244
|
import_lucide_react58 = require("lucide-react");
|
|
19184
|
-
|
|
19245
|
+
import_react62 = require("react");
|
|
19185
19246
|
init_auth();
|
|
19186
19247
|
init_useLayoutDataStore();
|
|
19187
19248
|
init_useLayoutStore();
|
|
@@ -19289,7 +19350,7 @@ var init_wallet = __esm({
|
|
|
19289
19350
|
init_projectId();
|
|
19290
19351
|
init_auth();
|
|
19291
19352
|
init_types();
|
|
19292
|
-
METADATA_API_URL = "https://dashboard.
|
|
19353
|
+
METADATA_API_URL = "https://dashboard.embarkai.io/api/public/project";
|
|
19293
19354
|
METADATA_CACHE_TTL = 36e5;
|
|
19294
19355
|
metadataCache = null;
|
|
19295
19356
|
}
|
|
@@ -19358,23 +19419,23 @@ var init_useFlowSelector = __esm({
|
|
|
19358
19419
|
});
|
|
19359
19420
|
|
|
19360
19421
|
// src/internal/components/SendMenu/hyperbridge/lib/chains.ts
|
|
19361
|
-
var
|
|
19422
|
+
var import_read14, import_chains, CHAINS_UI_META;
|
|
19362
19423
|
var init_chains = __esm({
|
|
19363
19424
|
"src/internal/components/SendMenu/hyperbridge/lib/chains.ts"() {
|
|
19364
19425
|
init_EthereumIcon();
|
|
19365
19426
|
init_LumiaIcon2();
|
|
19366
19427
|
init_BscIcon();
|
|
19367
|
-
|
|
19428
|
+
import_read14 = require("@embarkai/core/read");
|
|
19368
19429
|
import_chains = require("wagmi/chains");
|
|
19369
19430
|
CHAINS_UI_META = {
|
|
19370
19431
|
lumiaprism: {
|
|
19371
|
-
chainID:
|
|
19372
|
-
chainLabel:
|
|
19432
|
+
chainID: import_read14.lumiaMainnetChain.id,
|
|
19433
|
+
chainLabel: import_read14.lumiaMainnetChain.name,
|
|
19373
19434
|
chainName: "lumiaprism",
|
|
19374
19435
|
// exact hyperlane registry chain name
|
|
19375
19436
|
Icon: LumiaIcon2,
|
|
19376
|
-
explorerUrl:
|
|
19377
|
-
chain:
|
|
19437
|
+
explorerUrl: import_read14.lumiaMainnetChain.blockExplorers.default.url,
|
|
19438
|
+
chain: import_read14.lumiaMainnetChain
|
|
19378
19439
|
},
|
|
19379
19440
|
bsc: {
|
|
19380
19441
|
chainID: import_chains.bsc.id,
|
|
@@ -19478,23 +19539,23 @@ function SenderSelector() {
|
|
|
19478
19539
|
const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
|
|
19479
19540
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19480
19541
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19481
|
-
const pendingWalletRef = (0,
|
|
19542
|
+
const pendingWalletRef = (0, import_react63.useRef)(null);
|
|
19482
19543
|
const { profiles } = useLinkedProfiles();
|
|
19483
19544
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19484
19545
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19485
19546
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19486
|
-
const [walletMessage, setWalletMessage] = (0,
|
|
19487
|
-
(0,
|
|
19547
|
+
const [walletMessage, setWalletMessage] = (0, import_react63.useState)(null);
|
|
19548
|
+
(0, import_react63.useEffect)(() => {
|
|
19488
19549
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19489
19550
|
}, [walletMessage]);
|
|
19490
|
-
(0,
|
|
19551
|
+
(0, import_react63.useEffect)(() => {
|
|
19491
19552
|
const pending = pendingWalletRef.current;
|
|
19492
19553
|
if (!pending || !directWalletIsConnected || !directWalletAddress) return;
|
|
19493
19554
|
if (directWalletAddress.toLowerCase() !== pending.externalId?.toLowerCase()) return;
|
|
19494
19555
|
pendingWalletRef.current = null;
|
|
19495
19556
|
directWalletFlow(pending);
|
|
19496
19557
|
}, [directWalletIsConnected, directWalletAddress]);
|
|
19497
|
-
const { mutate: directWalletFlow, isPending: isDirectWalletLogin } = (0,
|
|
19558
|
+
const { mutate: directWalletFlow, isPending: isDirectWalletLogin } = (0, import_react_query43.useMutation)({
|
|
19498
19559
|
mutationFn: async (walletProfile2) => {
|
|
19499
19560
|
if (!walletProfile2?.meta?.walletName || !walletProfile2?.externalId || !walletProfile2?.meta?.walletType) {
|
|
19500
19561
|
console.error("[SENDER SELECTOR] Invalid wallet profile:", walletProfile2);
|
|
@@ -19618,15 +19679,15 @@ function SenderSelector() {
|
|
|
19618
19679
|
] })
|
|
19619
19680
|
] });
|
|
19620
19681
|
}
|
|
19621
|
-
var import_rainbowkit,
|
|
19682
|
+
var import_rainbowkit, import_react_query43, import_react63, import_wagmi, import_jsx_runtime91;
|
|
19622
19683
|
var init_SenderSelector = __esm({
|
|
19623
19684
|
"src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
|
|
19624
19685
|
init_ProviderContext();
|
|
19625
19686
|
init_i18n();
|
|
19626
19687
|
init_linkedProfiles();
|
|
19627
19688
|
import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
19628
|
-
|
|
19629
|
-
|
|
19689
|
+
import_react_query43 = require("@tanstack/react-query");
|
|
19690
|
+
import_react63 = require("react");
|
|
19630
19691
|
import_wagmi = require("wagmi");
|
|
19631
19692
|
init_wallet();
|
|
19632
19693
|
init_useLayoutDataStore();
|
|
@@ -19819,7 +19880,7 @@ function useBridge() {
|
|
|
19819
19880
|
const address = useSession((st) => st.address);
|
|
19820
19881
|
const { data: walletClient } = (0, import_wagmi2.useWalletClient)();
|
|
19821
19882
|
const { switchChainAsync } = (0, import_wagmi2.useSwitchChain)();
|
|
19822
|
-
const swapDirection = (0,
|
|
19883
|
+
const swapDirection = (0, import_react64.useCallback)(() => {
|
|
19823
19884
|
const {
|
|
19824
19885
|
bridgeStep,
|
|
19825
19886
|
originChain,
|
|
@@ -19833,7 +19894,7 @@ function useBridge() {
|
|
|
19833
19894
|
setOriginChain(destinationChain);
|
|
19834
19895
|
setDestinationChain(originChain);
|
|
19835
19896
|
}, []);
|
|
19836
|
-
const { mutate: estimateQuote } = (0,
|
|
19897
|
+
const { mutate: estimateQuote } = (0, import_react_query44.useMutation)({
|
|
19837
19898
|
mutationFn: async (amountToBridge) => {
|
|
19838
19899
|
useFlowSelectorStore.getState().setError(null);
|
|
19839
19900
|
useFlowSelectorStore.getState().setIsUiLocked(true);
|
|
@@ -19872,7 +19933,7 @@ function useBridge() {
|
|
|
19872
19933
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19873
19934
|
}
|
|
19874
19935
|
});
|
|
19875
|
-
const handleQuoteEstimation = (0,
|
|
19936
|
+
const handleQuoteEstimation = (0, import_react64.useCallback)((amnt) => {
|
|
19876
19937
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19877
19938
|
if (!amnt || !Number(amnt)) {
|
|
19878
19939
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -19902,7 +19963,7 @@ function useBridge() {
|
|
|
19902
19963
|
})
|
|
19903
19964
|
);
|
|
19904
19965
|
}, []);
|
|
19905
|
-
const { mutate: bridgeAsset, isPending: isAssetBridging } = (0,
|
|
19966
|
+
const { mutate: bridgeAsset, isPending: isAssetBridging } = (0, import_react_query44.useMutation)({
|
|
19906
19967
|
mutationFn: async () => {
|
|
19907
19968
|
const {
|
|
19908
19969
|
hyperRoute,
|
|
@@ -19998,14 +20059,14 @@ function useBridge() {
|
|
|
19998
20059
|
isAssetBridging
|
|
19999
20060
|
};
|
|
20000
20061
|
}
|
|
20001
|
-
var
|
|
20062
|
+
var import_react_query44, import_react64, import_wagmi2;
|
|
20002
20063
|
var init_useBridge = __esm({
|
|
20003
20064
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
20004
20065
|
init_SessionContext();
|
|
20005
20066
|
init_i18n();
|
|
20006
20067
|
init_useExternalWalletStore();
|
|
20007
|
-
|
|
20008
|
-
|
|
20068
|
+
import_react_query44 = require("@tanstack/react-query");
|
|
20069
|
+
import_react64 = require("react");
|
|
20009
20070
|
import_wagmi2 = require("wagmi");
|
|
20010
20071
|
init_useLayoutStore();
|
|
20011
20072
|
init_useFlowSelector();
|
|
@@ -20028,13 +20089,13 @@ function useHyperlaneRoutes() {
|
|
|
20028
20089
|
data: hyperlaneWarpRoutes = [],
|
|
20029
20090
|
isLoading: isLoadingWarpRoutes,
|
|
20030
20091
|
error: errorWarpRoutes
|
|
20031
|
-
} = (0,
|
|
20092
|
+
} = (0, import_react_query45.useQuery)({
|
|
20032
20093
|
retry: false,
|
|
20033
20094
|
enabled: !!address && page === "send" /* SEND */ && flow === "bridge",
|
|
20034
20095
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
20035
20096
|
queryFn: async () => getHyperlaneWarpRoutes()
|
|
20036
20097
|
});
|
|
20037
|
-
(0,
|
|
20098
|
+
(0, import_react65.useEffect)(() => {
|
|
20038
20099
|
if (!errorWarpRoutes) return;
|
|
20039
20100
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20040
20101
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20043,7 +20104,7 @@ function useHyperlaneRoutes() {
|
|
|
20043
20104
|
setOriginChain(null);
|
|
20044
20105
|
setDestinationChain(null);
|
|
20045
20106
|
}, [errorWarpRoutes]);
|
|
20046
|
-
(0,
|
|
20107
|
+
(0, import_react65.useEffect)(() => {
|
|
20047
20108
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20048
20109
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20049
20110
|
let originChainIndex = 0;
|
|
@@ -20063,12 +20124,12 @@ function useHyperlaneRoutes() {
|
|
|
20063
20124
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
20064
20125
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
20065
20126
|
}
|
|
20066
|
-
var
|
|
20127
|
+
var import_react_query45, import_react65, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
20067
20128
|
var init_useHyperlaneRoutes = __esm({
|
|
20068
20129
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
20069
20130
|
init_SessionContext();
|
|
20070
|
-
|
|
20071
|
-
|
|
20131
|
+
import_react_query45 = require("@tanstack/react-query");
|
|
20132
|
+
import_react65 = require("react");
|
|
20072
20133
|
init_useLayoutDataStore();
|
|
20073
20134
|
init_useFlowSelector();
|
|
20074
20135
|
init_api4();
|
|
@@ -20083,14 +20144,14 @@ function useMenuTitle(warpRoutes) {
|
|
|
20083
20144
|
const { t } = useT();
|
|
20084
20145
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20085
20146
|
const hyperRouteMeta = useBridgeStore((st) => (warpRoutes || [])?.find((route) => route.routeId === st.hyperRoute)) || null;
|
|
20086
|
-
(0,
|
|
20147
|
+
(0, import_react66.useEffect)(() => {
|
|
20087
20148
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20088
20149
|
switch (true) {
|
|
20089
20150
|
case bridgeStep === "sender-selector":
|
|
20090
20151
|
updateMenuTitle(t("passport:bridgeMenu.labels.sender"));
|
|
20091
20152
|
break;
|
|
20092
20153
|
case bridgeStep === "select-token":
|
|
20093
|
-
updateMenuTitle(t("passport:bridgeMenu.labels.
|
|
20154
|
+
updateMenuTitle(t("passport:bridgeMenu.labels.selectToken"));
|
|
20094
20155
|
break;
|
|
20095
20156
|
case bridgeStep === "confirm":
|
|
20096
20157
|
updateMenuTitle(t("passport:bridgeMenu.labels.confirm"));
|
|
@@ -20111,11 +20172,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
20111
20172
|
}
|
|
20112
20173
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
20113
20174
|
}
|
|
20114
|
-
var
|
|
20175
|
+
var import_react66;
|
|
20115
20176
|
var init_useMenuTitle = __esm({
|
|
20116
20177
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
20117
20178
|
init_i18n();
|
|
20118
|
-
|
|
20179
|
+
import_react66 = require("react");
|
|
20119
20180
|
init_useFlowSelector();
|
|
20120
20181
|
init_useBridgeStore();
|
|
20121
20182
|
}
|
|
@@ -20150,6 +20211,10 @@ function MetaMaskIcon(props) {
|
|
|
20150
20211
|
x: "0px",
|
|
20151
20212
|
y: "0px",
|
|
20152
20213
|
viewBox: "0 0 142 136.878",
|
|
20214
|
+
style: {
|
|
20215
|
+
// enableBackground: 'new 0 0 142 136.878',
|
|
20216
|
+
flexShrink: 0
|
|
20217
|
+
},
|
|
20153
20218
|
xmlSpace: "preserve",
|
|
20154
20219
|
children: [
|
|
20155
20220
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
@@ -20232,8 +20297,8 @@ function useAvailableSenders() {
|
|
|
20232
20297
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
20233
20298
|
const { profiles } = useLinkedProfiles();
|
|
20234
20299
|
const walletProfiles = profiles.filter((p) => p.provider === "wallet");
|
|
20235
|
-
const lastCalcedSenders = (0,
|
|
20236
|
-
(0,
|
|
20300
|
+
const lastCalcedSenders = (0, import_react67.useRef)([]);
|
|
20301
|
+
(0, import_react67.useEffect)(() => {
|
|
20237
20302
|
const sendersAccumulator = [
|
|
20238
20303
|
{
|
|
20239
20304
|
type: "embarkai-wallet",
|
|
@@ -20262,13 +20327,13 @@ function useAvailableSenders() {
|
|
|
20262
20327
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
20263
20328
|
}, [address, walletProfiles, activeChainId]);
|
|
20264
20329
|
}
|
|
20265
|
-
var
|
|
20330
|
+
var import_react67;
|
|
20266
20331
|
var init_useAvailableSenders = __esm({
|
|
20267
20332
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
20268
20333
|
init_SessionContext();
|
|
20269
20334
|
init_tokens();
|
|
20270
20335
|
init_linkedProfiles();
|
|
20271
|
-
|
|
20336
|
+
import_react67 = require("react");
|
|
20272
20337
|
init_wallets();
|
|
20273
20338
|
init_useFlowSelector();
|
|
20274
20339
|
init_useBridgeStore();
|
|
@@ -20277,7 +20342,7 @@ var init_useAvailableSenders = __esm({
|
|
|
20277
20342
|
|
|
20278
20343
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
|
|
20279
20344
|
function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
20280
|
-
const qc = (0,
|
|
20345
|
+
const qc = (0, import_react_query46.useQueryClient)();
|
|
20281
20346
|
const { t } = useT();
|
|
20282
20347
|
const address = useSession((st) => st.address);
|
|
20283
20348
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
@@ -20304,7 +20369,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20304
20369
|
const embarkTokenBalanace = assets.find((a) => a.symbol === selectedWarpRoute?.symbol);
|
|
20305
20370
|
const originChainMeta = CHAINS_UI_META[originChain];
|
|
20306
20371
|
const isSelectedTokenNative = selectedWarpRoute?.symbol?.toUpperCase() === originChainMeta?.chain?.nativeCurrency?.symbol?.toUpperCase();
|
|
20307
|
-
const { data: externalBalanceData, isLoading: isExternalBalanceLoading } = (0,
|
|
20372
|
+
const { data: externalBalanceData, isLoading: isExternalBalanceLoading } = (0, import_react_query46.useQuery)({
|
|
20308
20373
|
enabled: bridgeSender === "direct-wallet" && !isSelectedTokenNative && !!directWalletAddress && !!routeTokenAddress && !!originChain,
|
|
20309
20374
|
retry: false,
|
|
20310
20375
|
queryKey: [EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, originChain, directWalletAddress, routeTokenAddress],
|
|
@@ -20357,7 +20422,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20357
20422
|
enabled: bridgeSender === "direct-wallet" && isSelectedTokenNative && !!directWalletAddress && !!routeTokenAddress && !!originChain
|
|
20358
20423
|
}
|
|
20359
20424
|
});
|
|
20360
|
-
const refreshRouteTokenBalance = (0,
|
|
20425
|
+
const refreshRouteTokenBalance = (0, import_react68.useCallback)(
|
|
20361
20426
|
(senderWallet) => {
|
|
20362
20427
|
switch (true) {
|
|
20363
20428
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20373,7 +20438,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20373
20438
|
},
|
|
20374
20439
|
[refreshBalances, qc, refetchExternalNativeBalance]
|
|
20375
20440
|
);
|
|
20376
|
-
(0,
|
|
20441
|
+
(0, import_react68.useEffect)(() => {
|
|
20377
20442
|
if (!bridgeSender || !originChain) return;
|
|
20378
20443
|
switch (bridgeSender) {
|
|
20379
20444
|
case "embarkai-wallet":
|
|
@@ -20404,13 +20469,13 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20404
20469
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
20405
20470
|
};
|
|
20406
20471
|
}
|
|
20407
|
-
var
|
|
20472
|
+
var import_react_query46, import_react68, import_viem13, import_wagmi3, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY;
|
|
20408
20473
|
var init_useBridgeBalance = __esm({
|
|
20409
20474
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20410
20475
|
init_SessionContext();
|
|
20411
20476
|
init_i18n();
|
|
20412
|
-
|
|
20413
|
-
|
|
20477
|
+
import_react_query46 = require("@tanstack/react-query");
|
|
20478
|
+
import_react68 = require("react");
|
|
20414
20479
|
import_viem13 = require("viem");
|
|
20415
20480
|
import_wagmi3 = require("wagmi");
|
|
20416
20481
|
init_useBlockscoutAssets();
|
|
@@ -20491,11 +20556,11 @@ function SelectStep(props) {
|
|
|
20491
20556
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.selectToken") }),
|
|
20492
20557
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "w-4 h-4" }),
|
|
20493
20558
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)] leading-4", children: [
|
|
20494
|
-
isRouteTokenBalanceLoading && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react60.LoaderIcon, { className: "w-4 h-4 animate-spin" }),
|
|
20495
20559
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: "text-[var(--ui-kit-fg-muted)]", children: [
|
|
20496
20560
|
t("passport:common.balance"),
|
|
20497
20561
|
": "
|
|
20498
20562
|
] }),
|
|
20563
|
+
isRouteTokenBalanceLoading && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react60.LoaderIcon, { className: "w-4 h-4 animate-spin text-[var(--ui-kit-fg-muted)]" }),
|
|
20499
20564
|
!isRouteTokenBalanceLoading && /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: "font-semibold", children: [
|
|
20500
20565
|
formatPrice(Number(routeTokenBalance || 0)),
|
|
20501
20566
|
" ",
|
|
@@ -20527,7 +20592,7 @@ function SelectStep(props) {
|
|
|
20527
20592
|
variant: "outline",
|
|
20528
20593
|
size: "medium",
|
|
20529
20594
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20530
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
20595
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_react69.Fragment, { children: [
|
|
20531
20596
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react60.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20532
20597
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20533
20598
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20665,13 +20730,13 @@ function SelectStep(props) {
|
|
|
20665
20730
|
)
|
|
20666
20731
|
] });
|
|
20667
20732
|
}
|
|
20668
|
-
var import_lucide_react60,
|
|
20733
|
+
var import_lucide_react60, import_react69, import_jsx_runtime95;
|
|
20669
20734
|
var init_SelectStep = __esm({
|
|
20670
20735
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
20671
20736
|
init_tokens();
|
|
20672
20737
|
init_i18n();
|
|
20673
20738
|
import_lucide_react60 = require("lucide-react");
|
|
20674
|
-
|
|
20739
|
+
import_react69 = require("react");
|
|
20675
20740
|
init_priceFormatter();
|
|
20676
20741
|
init_utils2();
|
|
20677
20742
|
init_badge();
|
|
@@ -20721,7 +20786,7 @@ var init_checkbox = __esm({
|
|
|
20721
20786
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20722
20787
|
function ConfirmStep(props) {
|
|
20723
20788
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20724
|
-
const [userConsent, setUserConsent] = (0,
|
|
20789
|
+
const [userConsent, setUserConsent] = (0, import_react70.useState)(false);
|
|
20725
20790
|
const { t } = useT();
|
|
20726
20791
|
const address = useSession((st) => st.address);
|
|
20727
20792
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20829,13 +20894,13 @@ function ConfirmStep(props) {
|
|
|
20829
20894
|
)
|
|
20830
20895
|
] });
|
|
20831
20896
|
}
|
|
20832
|
-
var import_lucide_react62,
|
|
20897
|
+
var import_lucide_react62, import_react70, import_jsx_runtime97, P_CN;
|
|
20833
20898
|
var init_ConfirmStep = __esm({
|
|
20834
20899
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
20835
20900
|
init_SessionContext();
|
|
20836
20901
|
init_i18n();
|
|
20837
20902
|
import_lucide_react62 = require("lucide-react");
|
|
20838
|
-
|
|
20903
|
+
import_react70 = require("react");
|
|
20839
20904
|
init_priceFormatter();
|
|
20840
20905
|
init_utils2();
|
|
20841
20906
|
init_button();
|
|
@@ -20945,8 +21010,8 @@ function useHyperlaneHistory() {
|
|
|
20945
21010
|
const page = useLayoutDataStore((st) => st.page);
|
|
20946
21011
|
const flow = useFlowSelectorStore((st) => st.flow);
|
|
20947
21012
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20948
|
-
const [currentPage, setCurrentPage] = (0,
|
|
20949
|
-
const query = (0,
|
|
21013
|
+
const [currentPage, setCurrentPage] = (0, import_react71.useState)(1);
|
|
21014
|
+
const query = (0, import_react_query47.useQuery)({
|
|
20950
21015
|
retry: false,
|
|
20951
21016
|
refetchInterval: TX_HISTORY_POLLING_INTERVAL,
|
|
20952
21017
|
enabled: bridgeStep === "tx-history" && !!address && page === "send" /* SEND */ && flow === "bridge",
|
|
@@ -20959,12 +21024,12 @@ function useHyperlaneHistory() {
|
|
|
20959
21024
|
setCurrentPage
|
|
20960
21025
|
};
|
|
20961
21026
|
}
|
|
20962
|
-
var
|
|
21027
|
+
var import_react_query47, import_react71, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
20963
21028
|
var init_useHyperlaneHistory = __esm({
|
|
20964
21029
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
20965
21030
|
init_SessionContext();
|
|
20966
|
-
|
|
20967
|
-
|
|
21031
|
+
import_react_query47 = require("@tanstack/react-query");
|
|
21032
|
+
import_react71 = require("react");
|
|
20968
21033
|
init_useLayoutDataStore();
|
|
20969
21034
|
init_useFlowSelector();
|
|
20970
21035
|
init_api4();
|
|
@@ -21089,7 +21154,7 @@ function HistoryItem(props) {
|
|
|
21089
21154
|
updatedAt,
|
|
21090
21155
|
txStatus
|
|
21091
21156
|
} = props;
|
|
21092
|
-
const qc = (0,
|
|
21157
|
+
const qc = (0, import_react_query48.useQueryClient)();
|
|
21093
21158
|
const address = useSession((st) => st.address);
|
|
21094
21159
|
const warpRoutes = qc.getQueryData([HYPERLANE_WARP_ROUTES_QUERY_KEY, address]);
|
|
21095
21160
|
const assetWarpRoute = warpRoutes?.find((route) => {
|
|
@@ -21201,12 +21266,12 @@ function HistoryStep() {
|
|
|
21201
21266
|
!isHistoryLoading && historyItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(HistoryItem, { ...item }, item.id))
|
|
21202
21267
|
] });
|
|
21203
21268
|
}
|
|
21204
|
-
var
|
|
21269
|
+
var import_react_query48, import_dayjs7, import_lucide_react63, import_jsx_runtime99, P_CN3;
|
|
21205
21270
|
var init_HistoryStep = __esm({
|
|
21206
21271
|
"src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx"() {
|
|
21207
21272
|
init_SessionContext();
|
|
21208
21273
|
init_i18n();
|
|
21209
|
-
|
|
21274
|
+
import_react_query48 = require("@tanstack/react-query");
|
|
21210
21275
|
import_dayjs7 = __toESM(require("dayjs"), 1);
|
|
21211
21276
|
import_lucide_react63 = require("lucide-react");
|
|
21212
21277
|
init_tokens();
|
|
@@ -21229,9 +21294,9 @@ var init_HistoryStep = __esm({
|
|
|
21229
21294
|
function SelectAssetRoute(props) {
|
|
21230
21295
|
const { hyperlaneWarpRoutes } = props;
|
|
21231
21296
|
const { t } = useT();
|
|
21232
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0,
|
|
21297
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react72.useState)(false);
|
|
21233
21298
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21234
|
-
const tokenList = (0,
|
|
21299
|
+
const tokenList = (0, import_react72.useMemo)(() => {
|
|
21235
21300
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
21236
21301
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
21237
21302
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -21240,11 +21305,11 @@ function SelectAssetRoute(props) {
|
|
|
21240
21305
|
}));
|
|
21241
21306
|
}, [hyperlaneWarpRoutes]);
|
|
21242
21307
|
if (isTokenSymbolSelector) {
|
|
21243
|
-
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "w-full
|
|
21308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "w-full grid grid-cols-1 gap-[var(--ui-kit-gap)]", children: tokenList.map((asset, assetIdx) => /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
21244
21309
|
Button,
|
|
21245
21310
|
{
|
|
21246
21311
|
variant: selectedAssetSymbol === asset.symbol ? "default" : "outline",
|
|
21247
|
-
className: "w-full",
|
|
21312
|
+
className: "w-full justify-start",
|
|
21248
21313
|
onClick: () => {
|
|
21249
21314
|
useBridgeStore.getState().setBridgeAssetSymbol(asset.symbol);
|
|
21250
21315
|
setIsTokenSymbolSelector(false);
|
|
@@ -21328,13 +21393,13 @@ function SelectAssetRoute(props) {
|
|
|
21328
21393
|
] })
|
|
21329
21394
|
] });
|
|
21330
21395
|
}
|
|
21331
|
-
var import_lucide_react64,
|
|
21396
|
+
var import_lucide_react64, import_react72, import_jsx_runtime100;
|
|
21332
21397
|
var init_SelectAssetRoute = __esm({
|
|
21333
21398
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
21334
21399
|
init_tokens();
|
|
21335
21400
|
init_i18n();
|
|
21336
21401
|
import_lucide_react64 = require("lucide-react");
|
|
21337
|
-
|
|
21402
|
+
import_react72 = require("react");
|
|
21338
21403
|
init_button();
|
|
21339
21404
|
init_useFlowSelector();
|
|
21340
21405
|
init_ResolveChainIcon();
|
|
@@ -21361,7 +21426,7 @@ function HyperlaneBridge() {
|
|
|
21361
21426
|
const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
|
|
21362
21427
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21363
21428
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21364
|
-
(0,
|
|
21429
|
+
(0, import_react73.useEffect)(
|
|
21365
21430
|
() => () => {
|
|
21366
21431
|
useBridgeStore.getState().resetSelections();
|
|
21367
21432
|
},
|
|
@@ -21395,10 +21460,10 @@ function HyperlaneBridge() {
|
|
|
21395
21460
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(HistoryDetailsStep, {})
|
|
21396
21461
|
] });
|
|
21397
21462
|
}
|
|
21398
|
-
var
|
|
21463
|
+
var import_react73, import_jsx_runtime101;
|
|
21399
21464
|
var init_HyperlaneBridge = __esm({
|
|
21400
21465
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
21401
|
-
|
|
21466
|
+
import_react73 = require("react");
|
|
21402
21467
|
init_SenderSelector();
|
|
21403
21468
|
init_useBridge();
|
|
21404
21469
|
init_useHyperlaneRoutes();
|
|
@@ -21415,7 +21480,7 @@ function BridgeHistorySwitch(props) {
|
|
|
21415
21480
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21416
21481
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21417
21482
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21418
|
-
const lastBridgeStepRef = (0,
|
|
21483
|
+
const lastBridgeStepRef = (0, import_react74.useRef)(null);
|
|
21419
21484
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21420
21485
|
return null;
|
|
21421
21486
|
}
|
|
@@ -21433,10 +21498,10 @@ function BridgeHistorySwitch(props) {
|
|
|
21433
21498
|
}
|
|
21434
21499
|
);
|
|
21435
21500
|
}
|
|
21436
|
-
var
|
|
21501
|
+
var import_react74, import_jsx_runtime102;
|
|
21437
21502
|
var init_HistorySwitch = __esm({
|
|
21438
21503
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
21439
|
-
|
|
21504
|
+
import_react74 = require("react");
|
|
21440
21505
|
init_switch();
|
|
21441
21506
|
init_useFlowSelector();
|
|
21442
21507
|
init_useBridgeStore();
|
|
@@ -21527,11 +21592,11 @@ function looksLikeNickname(input) {
|
|
|
21527
21592
|
}
|
|
21528
21593
|
function useNicknameResolve(input, options) {
|
|
21529
21594
|
const { enabled = true, chainId } = options;
|
|
21530
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
21531
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
21595
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react75.useState)("");
|
|
21596
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react75.useState)(false);
|
|
21532
21597
|
const normalized = normalizeNickname(input);
|
|
21533
21598
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21534
|
-
(0,
|
|
21599
|
+
(0, import_react75.useEffect)(() => {
|
|
21535
21600
|
if (!isNicknameInput || !enabled) {
|
|
21536
21601
|
setDebouncedInput("");
|
|
21537
21602
|
setIsDebouncing(false);
|
|
@@ -21546,7 +21611,7 @@ function useNicknameResolve(input, options) {
|
|
|
21546
21611
|
clearTimeout(timer);
|
|
21547
21612
|
};
|
|
21548
21613
|
}, [normalized, isNicknameInput, enabled]);
|
|
21549
|
-
const query = (0,
|
|
21614
|
+
const query = (0, import_react_query49.useQuery)({
|
|
21550
21615
|
queryKey: [...QUERY_KEYS.nicknameResolve(debouncedInput), chainId],
|
|
21551
21616
|
queryFn: () => resolveNickname(debouncedInput, chainId),
|
|
21552
21617
|
enabled: enabled && isNicknameInput && debouncedInput.length > 0,
|
|
@@ -21557,7 +21622,7 @@ function useNicknameResolve(input, options) {
|
|
|
21557
21622
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
21558
21623
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
21559
21624
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
21560
|
-
const fingerprintVerification = (0,
|
|
21625
|
+
const fingerprintVerification = (0, import_react75.useMemo)(() => {
|
|
21561
21626
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
21562
21627
|
return null;
|
|
21563
21628
|
}
|
|
@@ -21579,11 +21644,11 @@ function useNicknameResolve(input, options) {
|
|
|
21579
21644
|
resolvedAddress
|
|
21580
21645
|
};
|
|
21581
21646
|
}
|
|
21582
|
-
var
|
|
21647
|
+
var import_react_query49, import_react75, DEBOUNCE_MS2;
|
|
21583
21648
|
var init_useNicknameResolve = __esm({
|
|
21584
21649
|
"src/hooks/useNicknameResolve.ts"() {
|
|
21585
|
-
|
|
21586
|
-
|
|
21650
|
+
import_react_query49 = require("@tanstack/react-query");
|
|
21651
|
+
import_react75 = require("react");
|
|
21587
21652
|
init_nickname();
|
|
21588
21653
|
init_profile();
|
|
21589
21654
|
init_nickname_validation();
|
|
@@ -21596,10 +21661,10 @@ var init_useNicknameResolve = __esm({
|
|
|
21596
21661
|
function useSendTransaction() {
|
|
21597
21662
|
const session = useSession((st) => st.session);
|
|
21598
21663
|
const address = useSession((st) => st.address);
|
|
21599
|
-
const [isLoading, setIsLoading] = (0,
|
|
21600
|
-
const [error, setError] = (0,
|
|
21601
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
21602
|
-
const sendTransaction = (0,
|
|
21664
|
+
const [isLoading, setIsLoading] = (0, import_react76.useState)(false);
|
|
21665
|
+
const [error, setError] = (0, import_react76.useState)(null);
|
|
21666
|
+
const [userOpHash, setUserOpHash] = (0, import_react76.useState)(null);
|
|
21667
|
+
const sendTransaction = (0, import_react76.useCallback)(
|
|
21603
21668
|
async (params) => {
|
|
21604
21669
|
if (!session || !address) {
|
|
21605
21670
|
setError("No active session");
|
|
@@ -21696,7 +21761,7 @@ function useSendTransaction() {
|
|
|
21696
21761
|
},
|
|
21697
21762
|
[session, address]
|
|
21698
21763
|
);
|
|
21699
|
-
const reset = (0,
|
|
21764
|
+
const reset = (0, import_react76.useCallback)(() => {
|
|
21700
21765
|
setError(null);
|
|
21701
21766
|
setUserOpHash(null);
|
|
21702
21767
|
setIsLoading(false);
|
|
@@ -21709,10 +21774,10 @@ function useSendTransaction() {
|
|
|
21709
21774
|
reset
|
|
21710
21775
|
};
|
|
21711
21776
|
}
|
|
21712
|
-
var
|
|
21777
|
+
var import_react76, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
21713
21778
|
var init_useSendTransaction = __esm({
|
|
21714
21779
|
"src/hooks/useSendTransaction.ts"() {
|
|
21715
|
-
|
|
21780
|
+
import_react76 = require("react");
|
|
21716
21781
|
import_viem14 = require("viem");
|
|
21717
21782
|
init_SessionContext();
|
|
21718
21783
|
init_account2();
|
|
@@ -21863,7 +21928,7 @@ var init_AssetInputIcon = __esm({
|
|
|
21863
21928
|
|
|
21864
21929
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21865
21930
|
function NftDisplayCard({ asset }) {
|
|
21866
|
-
const [imageError, setImageError] = (0,
|
|
21931
|
+
const [imageError, setImageError] = (0, import_react77.useState)(false);
|
|
21867
21932
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
21868
21933
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
21869
21934
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -21891,11 +21956,11 @@ function NftDisplayCard({ asset }) {
|
|
|
21891
21956
|
] })
|
|
21892
21957
|
] });
|
|
21893
21958
|
}
|
|
21894
|
-
var import_lucide_react66,
|
|
21959
|
+
var import_lucide_react66, import_react77, import_jsx_runtime104;
|
|
21895
21960
|
var init_NftDisplayCard = __esm({
|
|
21896
21961
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
21897
21962
|
import_lucide_react66 = require("lucide-react");
|
|
21898
|
-
|
|
21963
|
+
import_react77 = require("react");
|
|
21899
21964
|
import_jsx_runtime104 = require("react/jsx-runtime");
|
|
21900
21965
|
}
|
|
21901
21966
|
});
|
|
@@ -22546,10 +22611,10 @@ function SendMenu() {
|
|
|
22546
22611
|
userOpHash,
|
|
22547
22612
|
reset
|
|
22548
22613
|
} = useSendTransaction();
|
|
22549
|
-
(0,
|
|
22614
|
+
(0, import_react78.useEffect)(() => {
|
|
22550
22615
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22551
22616
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22552
|
-
(0,
|
|
22617
|
+
(0, import_react78.useEffect)(() => {
|
|
22553
22618
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22554
22619
|
}, [sendTransactionError]);
|
|
22555
22620
|
const {
|
|
@@ -22564,7 +22629,7 @@ function SendMenu() {
|
|
|
22564
22629
|
} = useSendStore();
|
|
22565
22630
|
const isNft = isNftAsset3(selectedAsset);
|
|
22566
22631
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22567
|
-
(0,
|
|
22632
|
+
(0, import_react78.useEffect)(
|
|
22568
22633
|
() => () => {
|
|
22569
22634
|
setSelectedAsset(null);
|
|
22570
22635
|
setRecipient("");
|
|
@@ -22574,7 +22639,7 @@ function SendMenu() {
|
|
|
22574
22639
|
},
|
|
22575
22640
|
[]
|
|
22576
22641
|
);
|
|
22577
|
-
(0,
|
|
22642
|
+
(0, import_react78.useEffect)(() => {
|
|
22578
22643
|
const shouldSetNativeAsset = assets.length > 0 && !selectedAsset;
|
|
22579
22644
|
if (!shouldSetNativeAsset) return;
|
|
22580
22645
|
const native = assets.find((a) => a.type === "native");
|
|
@@ -22585,7 +22650,7 @@ function SendMenu() {
|
|
|
22585
22650
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
22586
22651
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
22587
22652
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
22588
|
-
const complianceAmount = (0,
|
|
22653
|
+
const complianceAmount = (0, import_react78.useMemo)(() => {
|
|
22589
22654
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
22590
22655
|
try {
|
|
22591
22656
|
return (0, import_viem18.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -22600,7 +22665,7 @@ function SendMenu() {
|
|
|
22600
22665
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22601
22666
|
chainId: activeChainId
|
|
22602
22667
|
});
|
|
22603
|
-
(0,
|
|
22668
|
+
(0, import_react78.useEffect)(() => {
|
|
22604
22669
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22605
22670
|
switch (true) {
|
|
22606
22671
|
case txStep === "select-asset":
|
|
@@ -22664,7 +22729,7 @@ function SendMenu() {
|
|
|
22664
22729
|
] })
|
|
22665
22730
|
] });
|
|
22666
22731
|
}
|
|
22667
|
-
var import_lucide_react70,
|
|
22732
|
+
var import_lucide_react70, import_react78, import_viem18, import_jsx_runtime109;
|
|
22668
22733
|
var init_SendMenu = __esm({
|
|
22669
22734
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
22670
22735
|
init_SessionContext();
|
|
@@ -22673,7 +22738,7 @@ var init_SendMenu = __esm({
|
|
|
22673
22738
|
init_useSendTransaction();
|
|
22674
22739
|
init_useT();
|
|
22675
22740
|
import_lucide_react70 = require("lucide-react");
|
|
22676
|
-
|
|
22741
|
+
import_react78 = require("react");
|
|
22677
22742
|
import_viem18 = require("viem");
|
|
22678
22743
|
init_useBlockscoutAssets();
|
|
22679
22744
|
init_useLayoutDataStore();
|
|
@@ -22717,7 +22782,7 @@ function SelectorFlowButtons() {
|
|
|
22717
22782
|
Button,
|
|
22718
22783
|
{
|
|
22719
22784
|
size: "medium",
|
|
22720
|
-
variant: selectorFlow === "send" ? "
|
|
22785
|
+
variant: selectorFlow === "send" ? "default" : "ghost",
|
|
22721
22786
|
className: "flex-1 uppercase",
|
|
22722
22787
|
onClick: () => {
|
|
22723
22788
|
useFlowSelectorStore.getState().setError(null);
|
|
@@ -22733,7 +22798,7 @@ function SelectorFlowButtons() {
|
|
|
22733
22798
|
Button,
|
|
22734
22799
|
{
|
|
22735
22800
|
size: "medium",
|
|
22736
|
-
variant: selectorFlow === "bridge" ? "
|
|
22801
|
+
variant: selectorFlow === "bridge" ? "default" : "ghost",
|
|
22737
22802
|
className: "flex-1 uppercase",
|
|
22738
22803
|
onClick: () => {
|
|
22739
22804
|
useFlowSelectorStore.getState().setError(null);
|
|
@@ -22758,7 +22823,7 @@ function SendFlowSelector() {
|
|
|
22758
22823
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22759
22824
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22760
22825
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22761
|
-
(0,
|
|
22826
|
+
(0, import_react79.useEffect)(
|
|
22762
22827
|
() => () => {
|
|
22763
22828
|
useFlowSelectorStore.getState().setError(null);
|
|
22764
22829
|
},
|
|
@@ -22835,12 +22900,12 @@ function SendFlowSelector() {
|
|
|
22835
22900
|
}
|
|
22836
22901
|
);
|
|
22837
22902
|
}
|
|
22838
|
-
var import_lucide_react71,
|
|
22903
|
+
var import_lucide_react71, import_react79, import_jsx_runtime110, SELECTOR_FLOW;
|
|
22839
22904
|
var init_SendFlowSelector = __esm({
|
|
22840
22905
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
22841
22906
|
init_i18n();
|
|
22842
22907
|
import_lucide_react71 = require("lucide-react");
|
|
22843
|
-
|
|
22908
|
+
import_react79 = require("react");
|
|
22844
22909
|
init_useLayoutDataStore();
|
|
22845
22910
|
init_useLayoutStore();
|
|
22846
22911
|
init_utils2();
|
|
@@ -22895,12 +22960,12 @@ function getServerSnapshot() {
|
|
|
22895
22960
|
return false;
|
|
22896
22961
|
}
|
|
22897
22962
|
function useProMode() {
|
|
22898
|
-
return (0,
|
|
22963
|
+
return (0, import_react80.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
22899
22964
|
}
|
|
22900
|
-
var
|
|
22965
|
+
var import_react80, STORAGE_KEY, EVENT_NAME;
|
|
22901
22966
|
var init_pro_mode = __esm({
|
|
22902
22967
|
"src/internal/lib/pro-mode.ts"() {
|
|
22903
|
-
|
|
22968
|
+
import_react80 = require("react");
|
|
22904
22969
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
22905
22970
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
22906
22971
|
}
|
|
@@ -22960,7 +23025,7 @@ function useSettingsButtons() {
|
|
|
22960
23025
|
if (proMode) {
|
|
22961
23026
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: import_lucide_react73.HardDrive });
|
|
22962
23027
|
}
|
|
22963
|
-
(0,
|
|
23028
|
+
(0, import_react81.useEffect)(() => {
|
|
22964
23029
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22965
23030
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22966
23031
|
return;
|
|
@@ -22982,7 +23047,7 @@ function SettingsMenu() {
|
|
|
22982
23047
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
22983
23048
|
const settingsButtons = useSettingsButtons();
|
|
22984
23049
|
useProvidersList();
|
|
22985
|
-
(0,
|
|
23050
|
+
(0, import_react_query50.useQuery)({
|
|
22986
23051
|
retry: 1,
|
|
22987
23052
|
enabled: !!address,
|
|
22988
23053
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
@@ -23024,15 +23089,15 @@ function SettingsMenu() {
|
|
|
23024
23089
|
}
|
|
23025
23090
|
);
|
|
23026
23091
|
}
|
|
23027
|
-
var
|
|
23092
|
+
var import_react_query50, import_lucide_react73, import_react81, import_jsx_runtime112;
|
|
23028
23093
|
var init_SettingsMenu = __esm({
|
|
23029
23094
|
"src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
|
|
23030
23095
|
init_ProviderContext();
|
|
23031
23096
|
init_SessionContext();
|
|
23032
23097
|
init_i18n();
|
|
23033
|
-
|
|
23098
|
+
import_react_query50 = require("@tanstack/react-query");
|
|
23034
23099
|
import_lucide_react73 = require("lucide-react");
|
|
23035
|
-
|
|
23100
|
+
import_react81 = require("react");
|
|
23036
23101
|
init_nickname();
|
|
23037
23102
|
init_profile();
|
|
23038
23103
|
init_useLayoutDataStore();
|
|
@@ -23147,27 +23212,27 @@ function getHistoryUrls(params) {
|
|
|
23147
23212
|
}
|
|
23148
23213
|
return getBlockscoutHistoryUrls(params);
|
|
23149
23214
|
}
|
|
23150
|
-
var
|
|
23215
|
+
var import_read15, ETHERSCAN_V2_API_URL, BLOCKSCOUT_API_URLS, CHAIN_SPECIFIC_API_URLS, ETHERSCAN_CHAINS, UNSUPPORTED_HISTORY_CHAINS, TX_HISTORY_URLS;
|
|
23151
23216
|
var init_txUrls = __esm({
|
|
23152
23217
|
"src/internal/components/TransactionsMenu/txUrls.ts"() {
|
|
23153
|
-
|
|
23218
|
+
import_read15 = require("@embarkai/core/read");
|
|
23154
23219
|
init_base();
|
|
23155
23220
|
ETHERSCAN_V2_API_URL = "https://api.etherscan.io/v2/api";
|
|
23156
23221
|
BLOCKSCOUT_API_URLS = {
|
|
23157
|
-
[
|
|
23158
|
-
[
|
|
23222
|
+
[import_read15.ARBITRUM_SEPOLIA_CHAIN_ID]: "https://arbitrum-sepolia.blockscout.com/api",
|
|
23223
|
+
[import_read15.BASE_SEPOLIA_CHAIN_ID]: "https://base-sepolia.blockscout.com/api"
|
|
23159
23224
|
};
|
|
23160
23225
|
CHAIN_SPECIFIC_API_URLS = {};
|
|
23161
23226
|
ETHERSCAN_CHAINS = /* @__PURE__ */ new Set([
|
|
23162
|
-
|
|
23163
|
-
|
|
23164
|
-
|
|
23227
|
+
import_read15.SEPOLIA_CHAIN_ID,
|
|
23228
|
+
import_read15.ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
23229
|
+
import_read15.BASE_SEPOLIA_CHAIN_ID
|
|
23165
23230
|
]);
|
|
23166
23231
|
UNSUPPORTED_HISTORY_CHAINS = /* @__PURE__ */ new Set([
|
|
23167
|
-
|
|
23232
|
+
import_read15.BSC_TESTNET_CHAIN_ID
|
|
23168
23233
|
]);
|
|
23169
23234
|
TX_HISTORY_URLS = {
|
|
23170
|
-
[
|
|
23235
|
+
[import_read15.LUMIA_TESTNET_CHAIN_ID]: (p) => {
|
|
23171
23236
|
const result = getBlockscoutHistoryUrls(p);
|
|
23172
23237
|
return {
|
|
23173
23238
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -23175,7 +23240,7 @@ var init_txUrls = __esm({
|
|
|
23175
23240
|
tokenTransfersUrl: result.tokenTransfersUrl
|
|
23176
23241
|
};
|
|
23177
23242
|
},
|
|
23178
|
-
[
|
|
23243
|
+
[import_read15.LUMIA_MAINNET_CHAIN_ID]: (p) => {
|
|
23179
23244
|
const result = getBlockscoutHistoryUrls(p);
|
|
23180
23245
|
return {
|
|
23181
23246
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -23968,26 +24033,26 @@ var init_TransactionsGroup = __esm({
|
|
|
23968
24033
|
|
|
23969
24034
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
23970
24035
|
function TransactionsMenu() {
|
|
23971
|
-
const qc = (0,
|
|
24036
|
+
const qc = (0, import_react_query51.useQueryClient)();
|
|
23972
24037
|
const address = useSession((st) => st.address);
|
|
23973
24038
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
23974
24039
|
const { t } = useT();
|
|
23975
24040
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23976
24041
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
23977
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
24042
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react82.useState)({});
|
|
23978
24043
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
23979
24044
|
const {
|
|
23980
24045
|
data: txHistoryGroups = [],
|
|
23981
24046
|
isLoading: isTxHistoryLoading,
|
|
23982
24047
|
isFetching: isTxHistoryFetching,
|
|
23983
24048
|
error: txHistoryError
|
|
23984
|
-
} = (0,
|
|
24049
|
+
} = (0, import_react_query51.useQuery)({
|
|
23985
24050
|
retry: false,
|
|
23986
24051
|
enabled: !!address && !!chainConfig?.id && historySupported,
|
|
23987
24052
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23988
24053
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23989
24054
|
});
|
|
23990
|
-
const refreshTxHistory = (0,
|
|
24055
|
+
const refreshTxHistory = (0, import_react82.useCallback)(
|
|
23991
24056
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23992
24057
|
[qc, chainConfig.id, address]
|
|
23993
24058
|
);
|
|
@@ -24036,14 +24101,14 @@ function TransactionsMenu() {
|
|
|
24036
24101
|
}
|
|
24037
24102
|
);
|
|
24038
24103
|
}
|
|
24039
|
-
var
|
|
24104
|
+
var import_react_query51, import_lucide_react76, import_react82, import_jsx_runtime116;
|
|
24040
24105
|
var init_TransactionsMenu = __esm({
|
|
24041
24106
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
24042
24107
|
init_SessionContext();
|
|
24043
24108
|
init_i18n();
|
|
24044
|
-
|
|
24109
|
+
import_react_query51 = require("@tanstack/react-query");
|
|
24045
24110
|
import_lucide_react76 = require("lucide-react");
|
|
24046
|
-
|
|
24111
|
+
import_react82 = require("react");
|
|
24047
24112
|
init_useLayoutDataStore();
|
|
24048
24113
|
init_useLayoutStore();
|
|
24049
24114
|
init_Expandable2();
|
|
@@ -24241,7 +24306,7 @@ function usePageMapper() {
|
|
|
24241
24306
|
setIsDialogOpen,
|
|
24242
24307
|
setIsDialogClosing
|
|
24243
24308
|
} = useLayoutStore();
|
|
24244
|
-
const closeDialog = (0,
|
|
24309
|
+
const closeDialog = (0, import_react83.useCallback)(() => {
|
|
24245
24310
|
setIsDialogClosing(true);
|
|
24246
24311
|
setTimeout(() => {
|
|
24247
24312
|
setDialogContent(null);
|
|
@@ -24252,7 +24317,7 @@ function usePageMapper() {
|
|
|
24252
24317
|
setIsDialogOpen(false);
|
|
24253
24318
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24254
24319
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24255
|
-
const openDialog = (0,
|
|
24320
|
+
const openDialog = (0, import_react83.useCallback)(
|
|
24256
24321
|
(pageItem) => {
|
|
24257
24322
|
const PageContentComponent = pageItem.component;
|
|
24258
24323
|
setDialogTitle(pageItem.title);
|
|
@@ -24262,7 +24327,7 @@ function usePageMapper() {
|
|
|
24262
24327
|
},
|
|
24263
24328
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24264
24329
|
);
|
|
24265
|
-
(0,
|
|
24330
|
+
(0, import_react83.useEffect)(() => {
|
|
24266
24331
|
if (page === null) return closeDialog();
|
|
24267
24332
|
const pageItem = PAGE_MAP[page];
|
|
24268
24333
|
if (!pageItem) {
|
|
@@ -24273,10 +24338,10 @@ function usePageMapper() {
|
|
|
24273
24338
|
openDialog(pageItem);
|
|
24274
24339
|
}, [page, closeDialog, openDialog]);
|
|
24275
24340
|
}
|
|
24276
|
-
var
|
|
24341
|
+
var import_react83, import_jsx_runtime117, CLEAR_DIALOG_TIMEOUT;
|
|
24277
24342
|
var init_usePageMapper = __esm({
|
|
24278
24343
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
24279
|
-
|
|
24344
|
+
import_react83 = require("react");
|
|
24280
24345
|
init_PageMap();
|
|
24281
24346
|
init_constants();
|
|
24282
24347
|
init_useLayoutDataStore();
|
|
@@ -24292,32 +24357,32 @@ function useSettingsNotifications() {
|
|
|
24292
24357
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
24293
24358
|
const providers = import_auth21.jwtTokenManager.getProviders();
|
|
24294
24359
|
const hasEmail = providers.includes("email");
|
|
24295
|
-
const { data: userProfile = null } = (0,
|
|
24360
|
+
const { data: userProfile = null } = (0, import_react_query52.useQuery)({
|
|
24296
24361
|
retry: false,
|
|
24297
24362
|
enabled: !!address,
|
|
24298
24363
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24299
24364
|
queryFn: getUserProfile
|
|
24300
24365
|
});
|
|
24301
|
-
(0,
|
|
24366
|
+
(0, import_react84.useEffect)(() => {
|
|
24302
24367
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24303
24368
|
setSettingsNotifications({
|
|
24304
24369
|
...COMPLETE_KYC_PROGRESS,
|
|
24305
24370
|
status: isKYCVerified ? "resolved" : "active"
|
|
24306
24371
|
});
|
|
24307
24372
|
}, [userProfile, setSettingsNotifications]);
|
|
24308
|
-
(0,
|
|
24373
|
+
(0, import_react84.useEffect)(() => {
|
|
24309
24374
|
setSettingsNotifications({
|
|
24310
24375
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24311
24376
|
status: hasEmail ? "resolved" : "active"
|
|
24312
24377
|
});
|
|
24313
24378
|
}, [hasEmail, setSettingsNotifications]);
|
|
24314
24379
|
}
|
|
24315
|
-
var
|
|
24380
|
+
var import_react_query52, import_react84, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
24316
24381
|
var init_useSettingsNotifications = __esm({
|
|
24317
24382
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
24318
24383
|
init_SessionContext();
|
|
24319
|
-
|
|
24320
|
-
|
|
24384
|
+
import_react_query52 = require("@tanstack/react-query");
|
|
24385
|
+
import_react84 = require("react");
|
|
24321
24386
|
init_auth();
|
|
24322
24387
|
init_profile();
|
|
24323
24388
|
init_useLayoutDataStore();
|
|
@@ -24340,7 +24405,7 @@ var init_package = __esm({
|
|
|
24340
24405
|
"package.json"() {
|
|
24341
24406
|
package_default = {
|
|
24342
24407
|
name: "@embarkai/ui-kit",
|
|
24343
|
-
version: "0.4.
|
|
24408
|
+
version: "0.4.33",
|
|
24344
24409
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24345
24410
|
type: "module",
|
|
24346
24411
|
main: "./dist/index.cjs",
|
|
@@ -24439,14 +24504,14 @@ var init_package = __esm({
|
|
|
24439
24504
|
|
|
24440
24505
|
// src/internal/components/Footer/Footer.tsx
|
|
24441
24506
|
function Footer() {
|
|
24442
|
-
const qc = (0,
|
|
24507
|
+
const qc = (0, import_react_query53.useQueryClient)();
|
|
24443
24508
|
const { callbacksRef } = useProviderConfig();
|
|
24444
24509
|
const { address, setSession, setAddress, setStatus, setError, setIsLoading } = useSession();
|
|
24445
24510
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24446
24511
|
const { t } = useT();
|
|
24447
24512
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24448
24513
|
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
24449
|
-
const { mutate: disconnect, isPending: isDisconnecting } = (0,
|
|
24514
|
+
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query53.useMutation)({
|
|
24450
24515
|
mutationFn: async (disconnectAddress) => {
|
|
24451
24516
|
if (!disconnectAddress) throw new Error("No address to disconnect");
|
|
24452
24517
|
setIsDialogForced(true);
|
|
@@ -24528,7 +24593,7 @@ function Footer() {
|
|
|
24528
24593
|
}
|
|
24529
24594
|
);
|
|
24530
24595
|
}
|
|
24531
|
-
var
|
|
24596
|
+
var import_react_query53, import_lucide_react77, import_jsx_runtime118;
|
|
24532
24597
|
var init_Footer = __esm({
|
|
24533
24598
|
"src/internal/components/Footer/Footer.tsx"() {
|
|
24534
24599
|
init_package();
|
|
@@ -24536,7 +24601,7 @@ var init_Footer = __esm({
|
|
|
24536
24601
|
init_ProviderContext();
|
|
24537
24602
|
init_SessionContext();
|
|
24538
24603
|
init_i18n();
|
|
24539
|
-
|
|
24604
|
+
import_react_query53 = require("@tanstack/react-query");
|
|
24540
24605
|
import_lucide_react77 = require("lucide-react");
|
|
24541
24606
|
init_auth();
|
|
24542
24607
|
init_base();
|
|
@@ -24567,11 +24632,11 @@ function Header() {
|
|
|
24567
24632
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24568
24633
|
const { t } = useT();
|
|
24569
24634
|
const proMode = useProMode();
|
|
24570
|
-
const [proToast, setProToast] = (0,
|
|
24571
|
-
const [copied, setCopied] = (0,
|
|
24572
|
-
const clickCountRef = (0,
|
|
24573
|
-
const clickTimerRef = (0,
|
|
24574
|
-
const handleAvatarClick = (0,
|
|
24635
|
+
const [proToast, setProToast] = (0, import_react85.useState)(false);
|
|
24636
|
+
const [copied, setCopied] = (0, import_react85.useState)(false);
|
|
24637
|
+
const clickCountRef = (0, import_react85.useRef)(0);
|
|
24638
|
+
const clickTimerRef = (0, import_react85.useRef)(null);
|
|
24639
|
+
const handleAvatarClick = (0, import_react85.useCallback)(() => {
|
|
24575
24640
|
clickCountRef.current += 1;
|
|
24576
24641
|
if (clickTimerRef.current) {
|
|
24577
24642
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24589,7 +24654,7 @@ function Header() {
|
|
|
24589
24654
|
}, 1e3);
|
|
24590
24655
|
}
|
|
24591
24656
|
}, []);
|
|
24592
|
-
const { data: profile, isLoading: isProfileLoading } = (0,
|
|
24657
|
+
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query54.useQuery)({
|
|
24593
24658
|
retry: false,
|
|
24594
24659
|
enabled: !!address,
|
|
24595
24660
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
@@ -24671,7 +24736,7 @@ function Header() {
|
|
|
24671
24736
|
}
|
|
24672
24737
|
);
|
|
24673
24738
|
}
|
|
24674
|
-
var
|
|
24739
|
+
var import_react_query54, import_lucide_react78, import_react85, import_jsx_runtime119;
|
|
24675
24740
|
var init_Header = __esm({
|
|
24676
24741
|
"src/internal/components/Header/Header.tsx"() {
|
|
24677
24742
|
init_LumiaIcon3();
|
|
@@ -24679,9 +24744,9 @@ var init_Header = __esm({
|
|
|
24679
24744
|
init_ProviderContext();
|
|
24680
24745
|
init_SessionContext();
|
|
24681
24746
|
init_useT();
|
|
24682
|
-
|
|
24747
|
+
import_react_query54 = require("@tanstack/react-query");
|
|
24683
24748
|
import_lucide_react78 = require("lucide-react");
|
|
24684
|
-
|
|
24749
|
+
import_react85 = require("react");
|
|
24685
24750
|
init_PositiveIcon();
|
|
24686
24751
|
init_auth();
|
|
24687
24752
|
init_profile();
|
|
@@ -24712,7 +24777,7 @@ function useDecideContentStyles() {
|
|
|
24712
24777
|
style: (0, import_lodash_es7.merge)({}, mobileStyles)
|
|
24713
24778
|
};
|
|
24714
24779
|
}
|
|
24715
|
-
var DialogPrimitive, import_lodash_es7, import_lucide_react79,
|
|
24780
|
+
var DialogPrimitive, import_lodash_es7, import_lucide_react79, import_react86, import_jsx_runtime120, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
24716
24781
|
var init_dialog = __esm({
|
|
24717
24782
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24718
24783
|
init_utils2();
|
|
@@ -24721,14 +24786,14 @@ var init_dialog = __esm({
|
|
|
24721
24786
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24722
24787
|
import_lodash_es7 = require("lodash-es");
|
|
24723
24788
|
import_lucide_react79 = require("lucide-react");
|
|
24724
|
-
|
|
24789
|
+
import_react86 = require("react");
|
|
24725
24790
|
init_useLayoutDataStore();
|
|
24726
24791
|
init_useLayoutStore();
|
|
24727
24792
|
init_button();
|
|
24728
24793
|
import_jsx_runtime120 = require("react/jsx-runtime");
|
|
24729
24794
|
Dialog = DialogPrimitive.Root;
|
|
24730
24795
|
DialogPortal = DialogPrimitive.Portal;
|
|
24731
|
-
DialogOverlay = (0,
|
|
24796
|
+
DialogOverlay = (0, import_react86.forwardRef)(
|
|
24732
24797
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
24733
24798
|
DialogPrimitive.Overlay,
|
|
24734
24799
|
{
|
|
@@ -24750,7 +24815,7 @@ var init_dialog = __esm({
|
|
|
24750
24815
|
border: "1px solid var(--ui-kit-bd)",
|
|
24751
24816
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
24752
24817
|
};
|
|
24753
|
-
DialogContent = (0,
|
|
24818
|
+
DialogContent = (0, import_react86.forwardRef)(
|
|
24754
24819
|
({ className, children, colorMode, ...props }, ref) => {
|
|
24755
24820
|
const { t, i18n } = useT();
|
|
24756
24821
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -24853,7 +24918,7 @@ var init_dialog = __esm({
|
|
|
24853
24918
|
DialogHeader.displayName = "DialogHeader";
|
|
24854
24919
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
24855
24920
|
DialogFooter.displayName = "DialogFooter";
|
|
24856
|
-
DialogTitle = (0,
|
|
24921
|
+
DialogTitle = (0, import_react86.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
24857
24922
|
DialogPrimitive.Title,
|
|
24858
24923
|
{
|
|
24859
24924
|
ref,
|
|
@@ -24862,7 +24927,7 @@ var init_dialog = __esm({
|
|
|
24862
24927
|
}
|
|
24863
24928
|
));
|
|
24864
24929
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
24865
|
-
DialogDescription = (0,
|
|
24930
|
+
DialogDescription = (0, import_react86.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
24866
24931
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
24867
24932
|
}
|
|
24868
24933
|
});
|
|
@@ -24887,7 +24952,7 @@ function Dialog2() {
|
|
|
24887
24952
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24888
24953
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24889
24954
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24890
|
-
(0,
|
|
24955
|
+
(0, import_react87.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24891
24956
|
usePageMapper();
|
|
24892
24957
|
useAutoConnect();
|
|
24893
24958
|
useBackupStatusChanges();
|
|
@@ -24925,13 +24990,13 @@ function Dialog2() {
|
|
|
24925
24990
|
}
|
|
24926
24991
|
);
|
|
24927
24992
|
}
|
|
24928
|
-
var import_framer_motion,
|
|
24993
|
+
var import_framer_motion, import_react87, import_jsx_runtime122;
|
|
24929
24994
|
var init_Dialog = __esm({
|
|
24930
24995
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
24931
24996
|
init_ProviderContext();
|
|
24932
24997
|
init_SessionContext();
|
|
24933
24998
|
import_framer_motion = require("framer-motion");
|
|
24934
|
-
|
|
24999
|
+
import_react87 = require("react");
|
|
24935
25000
|
init_constants();
|
|
24936
25001
|
init_useAutoConnect();
|
|
24937
25002
|
init_useBackupStatusChanges();
|
|
@@ -24957,14 +25022,14 @@ var init_Dialog2 = __esm({
|
|
|
24957
25022
|
});
|
|
24958
25023
|
|
|
24959
25024
|
// src/internal/components/TssManager.tsx
|
|
24960
|
-
var
|
|
25025
|
+
var import_react88, TssManagerWithRef;
|
|
24961
25026
|
var init_TssManager = __esm({
|
|
24962
25027
|
"src/internal/components/TssManager.tsx"() {
|
|
24963
25028
|
init_SessionContext();
|
|
24964
|
-
|
|
25029
|
+
import_react88 = __toESM(require("react"), 1);
|
|
24965
25030
|
init_auth();
|
|
24966
25031
|
init_clients();
|
|
24967
|
-
TssManagerWithRef =
|
|
25032
|
+
TssManagerWithRef = import_react88.default.forwardRef((props, ref) => {
|
|
24968
25033
|
const { mpcPin } = props;
|
|
24969
25034
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
24970
25035
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -24972,14 +25037,14 @@ var init_TssManager = __esm({
|
|
|
24972
25037
|
const setStatus = useSession((st) => st.setStatus);
|
|
24973
25038
|
const setSession = useSession((st) => st.setSession);
|
|
24974
25039
|
const setAddress = useSession((st) => st.setAddress);
|
|
24975
|
-
const onSessionCreated = (0,
|
|
25040
|
+
const onSessionCreated = (0, import_react88.useCallback)(
|
|
24976
25041
|
(session, address) => {
|
|
24977
25042
|
setSession(session);
|
|
24978
25043
|
setAddress(address);
|
|
24979
25044
|
},
|
|
24980
25045
|
[setSession, setAddress]
|
|
24981
25046
|
);
|
|
24982
|
-
const createSessionWithKeyshare =
|
|
25047
|
+
const createSessionWithKeyshare = import_react88.default.useCallback(
|
|
24983
25048
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
24984
25049
|
setStatus("checking key management setup...");
|
|
24985
25050
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -25004,7 +25069,7 @@ var init_TssManager = __esm({
|
|
|
25004
25069
|
},
|
|
25005
25070
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
25006
25071
|
);
|
|
25007
|
-
|
|
25072
|
+
import_react88.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
25008
25073
|
return null;
|
|
25009
25074
|
});
|
|
25010
25075
|
}
|
|
@@ -25012,7 +25077,7 @@ var init_TssManager = __esm({
|
|
|
25012
25077
|
|
|
25013
25078
|
// src/internal/components/WalletConnectHandler.tsx
|
|
25014
25079
|
function WalletConnectHandler() {
|
|
25015
|
-
const qc = (0,
|
|
25080
|
+
const qc = (0, import_react_query55.useQueryClient)();
|
|
25016
25081
|
const { callbacksRef } = useProviderConfig();
|
|
25017
25082
|
const passportWalletAddress = useSession((st) => st.address);
|
|
25018
25083
|
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi5.useAccount)();
|
|
@@ -25032,7 +25097,7 @@ function WalletConnectHandler() {
|
|
|
25032
25097
|
const projectId = providerConfig?.projectId;
|
|
25033
25098
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
25034
25099
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
25035
|
-
const onLinkingComplete = (0,
|
|
25100
|
+
const onLinkingComplete = (0, import_react89.useCallback)(
|
|
25036
25101
|
async (success) => {
|
|
25037
25102
|
setIsWalletLinking(false);
|
|
25038
25103
|
if (!success && !passportWalletAddress) {
|
|
@@ -25061,10 +25126,10 @@ function WalletConnectHandler() {
|
|
|
25061
25126
|
},
|
|
25062
25127
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
25063
25128
|
);
|
|
25064
|
-
const [hasStartedLinking, setHasStartedLinking] =
|
|
25065
|
-
const [modalWasOpened, setModalWasOpened] =
|
|
25066
|
-
const [pendingModalOpen, setPendingModalOpen] =
|
|
25067
|
-
(0,
|
|
25129
|
+
const [hasStartedLinking, setHasStartedLinking] = import_react89.default.useState(false);
|
|
25130
|
+
const [modalWasOpened, setModalWasOpened] = import_react89.default.useState(false);
|
|
25131
|
+
const [pendingModalOpen, setPendingModalOpen] = import_react89.default.useState(false);
|
|
25132
|
+
(0, import_react89.useEffect)(() => {
|
|
25068
25133
|
if (isWalletLinking && !hasStartedLinking) {
|
|
25069
25134
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
25070
25135
|
isConnected,
|
|
@@ -25102,18 +25167,18 @@ function WalletConnectHandler() {
|
|
|
25102
25167
|
setProviderType,
|
|
25103
25168
|
walletMode
|
|
25104
25169
|
]);
|
|
25105
|
-
(0,
|
|
25170
|
+
(0, import_react89.useEffect)(() => {
|
|
25106
25171
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25107
25172
|
setPendingModalOpen(false);
|
|
25108
25173
|
openConnectModal();
|
|
25109
25174
|
}
|
|
25110
25175
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25111
|
-
(0,
|
|
25176
|
+
(0, import_react89.useEffect)(() => {
|
|
25112
25177
|
if (connectModalOpen && hasStartedLinking) {
|
|
25113
25178
|
setModalWasOpened(true);
|
|
25114
25179
|
}
|
|
25115
25180
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25116
|
-
(0,
|
|
25181
|
+
(0, import_react89.useEffect)(() => {
|
|
25117
25182
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25118
25183
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25119
25184
|
onLinkingComplete(false);
|
|
@@ -25121,7 +25186,7 @@ function WalletConnectHandler() {
|
|
|
25121
25186
|
setModalWasOpened(false);
|
|
25122
25187
|
}
|
|
25123
25188
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25124
|
-
(0,
|
|
25189
|
+
(0, import_react89.useEffect)(() => {
|
|
25125
25190
|
if (isWalletLinking) {
|
|
25126
25191
|
const timeout = setTimeout(() => {
|
|
25127
25192
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25140,7 +25205,7 @@ function WalletConnectHandler() {
|
|
|
25140
25205
|
}
|
|
25141
25206
|
}, [isWalletLinking, setIsWalletLinking, disconnect]);
|
|
25142
25207
|
const isAuthFlow = !passportWalletAddress;
|
|
25143
|
-
const { mutate: handleWalletSign, isPending: isWalletSigning } = (0,
|
|
25208
|
+
const { mutate: handleWalletSign, isPending: isWalletSigning } = (0, import_react_query55.useMutation)({
|
|
25144
25209
|
mutationFn: async (payload) => {
|
|
25145
25210
|
const { chainId, signingWalletAddress } = payload;
|
|
25146
25211
|
if (!signingWalletAddress || !chainId) {
|
|
@@ -25241,7 +25306,7 @@ function WalletConnectHandler() {
|
|
|
25241
25306
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25242
25307
|
}
|
|
25243
25308
|
});
|
|
25244
|
-
(0,
|
|
25309
|
+
(0, import_react89.useEffect)(() => {
|
|
25245
25310
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25246
25311
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25247
25312
|
if (!passportWalletAddress) {
|
|
@@ -25251,7 +25316,7 @@ function WalletConnectHandler() {
|
|
|
25251
25316
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25252
25317
|
}
|
|
25253
25318
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25254
|
-
(0,
|
|
25319
|
+
(0, import_react89.useEffect)(() => {
|
|
25255
25320
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25256
25321
|
const timeout = setTimeout(() => {
|
|
25257
25322
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25273,15 +25338,15 @@ function WalletConnectHandler() {
|
|
|
25273
25338
|
]);
|
|
25274
25339
|
return null;
|
|
25275
25340
|
}
|
|
25276
|
-
var import_rainbowkit2,
|
|
25341
|
+
var import_rainbowkit2, import_react_query55, import_react89, import_wagmi5;
|
|
25277
25342
|
var init_WalletConnectHandler = __esm({
|
|
25278
25343
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25279
25344
|
init_ProviderContext();
|
|
25280
25345
|
init_SessionContext();
|
|
25281
25346
|
init_linkedProfiles();
|
|
25282
25347
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25283
|
-
|
|
25284
|
-
|
|
25348
|
+
import_react_query55 = require("@tanstack/react-query");
|
|
25349
|
+
import_react89 = __toESM(require("react"), 1);
|
|
25285
25350
|
import_wagmi5 = require("wagmi");
|
|
25286
25351
|
init_wallet();
|
|
25287
25352
|
init_AuthMenu2();
|
|
@@ -25302,13 +25367,13 @@ function DirectWalletHandler() {
|
|
|
25302
25367
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25303
25368
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25304
25369
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25305
|
-
(0,
|
|
25370
|
+
(0, import_react90.useEffect)(() => {
|
|
25306
25371
|
setConfigMode(walletMode);
|
|
25307
25372
|
if (walletMode !== "both") {
|
|
25308
25373
|
setActiveMode(walletMode);
|
|
25309
25374
|
}
|
|
25310
25375
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25311
|
-
(0,
|
|
25376
|
+
(0, import_react90.useEffect)(() => {
|
|
25312
25377
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25313
25378
|
setExternalWallet({
|
|
25314
25379
|
address,
|
|
@@ -25317,17 +25382,17 @@ function DirectWalletHandler() {
|
|
|
25317
25382
|
});
|
|
25318
25383
|
}
|
|
25319
25384
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25320
|
-
(0,
|
|
25385
|
+
(0, import_react90.useEffect)(() => {
|
|
25321
25386
|
if (isExternalConnected && !isConnected) {
|
|
25322
25387
|
clearExternalWallet();
|
|
25323
25388
|
}
|
|
25324
25389
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25325
|
-
(0,
|
|
25390
|
+
(0, import_react90.useEffect)(() => {
|
|
25326
25391
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25327
25392
|
setExternalChainId(chain.id);
|
|
25328
25393
|
}
|
|
25329
25394
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25330
|
-
(0,
|
|
25395
|
+
(0, import_react90.useEffect)(() => {
|
|
25331
25396
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25332
25397
|
setExternalWallet({
|
|
25333
25398
|
address,
|
|
@@ -25338,10 +25403,10 @@ function DirectWalletHandler() {
|
|
|
25338
25403
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25339
25404
|
return null;
|
|
25340
25405
|
}
|
|
25341
|
-
var
|
|
25406
|
+
var import_react90, import_wagmi6;
|
|
25342
25407
|
var init_DirectWalletHandler = __esm({
|
|
25343
25408
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25344
|
-
|
|
25409
|
+
import_react90 = require("react");
|
|
25345
25410
|
import_wagmi6 = require("wagmi");
|
|
25346
25411
|
init_ProviderContext();
|
|
25347
25412
|
init_useExternalWalletStore();
|
|
@@ -25353,9 +25418,9 @@ function getChainParams(chainCfg) {
|
|
|
25353
25418
|
return {
|
|
25354
25419
|
activeChainId: chainCfg.id,
|
|
25355
25420
|
chainConfig: chainCfg,
|
|
25356
|
-
publicClient: (0,
|
|
25357
|
-
bundlerClient: (0,
|
|
25358
|
-
viemChain: (0,
|
|
25421
|
+
publicClient: (0, import_read16.createPublicClientForChain)(chainCfg.id),
|
|
25422
|
+
bundlerClient: (0, import_read16.createBundlerClientForChain)(chainCfg.id),
|
|
25423
|
+
viemChain: (0, import_read16.getViemChain)(chainCfg.id)
|
|
25359
25424
|
};
|
|
25360
25425
|
}
|
|
25361
25426
|
function waitForStoreHydration() {
|
|
@@ -25366,7 +25431,7 @@ function waitForStoreHydration() {
|
|
|
25366
25431
|
}
|
|
25367
25432
|
function SessionProvider({ children }) {
|
|
25368
25433
|
const config = useProviderConfig().config;
|
|
25369
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
25434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_react91.Fragment, { children: [
|
|
25370
25435
|
children,
|
|
25371
25436
|
config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(WalletConnectHandler, {}),
|
|
25372
25437
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(DirectWalletHandler, {}),
|
|
@@ -25381,11 +25446,11 @@ function SessionProvider({ children }) {
|
|
|
25381
25446
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Dialog2, {})
|
|
25382
25447
|
] });
|
|
25383
25448
|
}
|
|
25384
|
-
var
|
|
25449
|
+
var import_read16, import_react91, import_zustand11, import_middleware3, import_jsx_runtime123, useSession, requireActiveChainId;
|
|
25385
25450
|
var init_SessionContext = __esm({
|
|
25386
25451
|
"src/context/SessionContext.tsx"() {
|
|
25387
|
-
|
|
25388
|
-
|
|
25452
|
+
import_read16 = require("@embarkai/core/read");
|
|
25453
|
+
import_react91 = require("react");
|
|
25389
25454
|
import_zustand11 = require("zustand");
|
|
25390
25455
|
import_middleware3 = require("zustand/middleware");
|
|
25391
25456
|
init_BalanceFeedProvider2();
|
|
@@ -25456,7 +25521,7 @@ var init_SessionContext = __esm({
|
|
|
25456
25521
|
// Set default chainId after hydration if not persisted
|
|
25457
25522
|
onRehydrateStorage: () => (state) => {
|
|
25458
25523
|
if (!state) return;
|
|
25459
|
-
const hydartedChain = getChainParams((0,
|
|
25524
|
+
const hydartedChain = getChainParams((0, import_read16.getChainConfig)(state.activeChainId || import_read16.DEFAULT_CHAIN_ID));
|
|
25460
25525
|
state.activeChainId = hydartedChain.activeChainId;
|
|
25461
25526
|
state.publicClient = hydartedChain.publicClient;
|
|
25462
25527
|
state.bundlerClient = hydartedChain.bundlerClient;
|
|
@@ -25519,7 +25584,7 @@ function getDashboardApiUrl() {
|
|
|
25519
25584
|
const serviceUrls = getServiceUrls();
|
|
25520
25585
|
const paramUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("dashboardApiUrl") || void 0 : void 0;
|
|
25521
25586
|
const envUrl = getEnvVar("VITE_LUMIA_DASHBOARD_API_URL") || getEnvVar("LUMIA_DASHBOARD_API_URL");
|
|
25522
|
-
return paramUrl || serviceUrls.dashboardApiUrl || envUrl || "https://dashboard.
|
|
25587
|
+
return paramUrl || serviceUrls.dashboardApiUrl || envUrl || "https://dashboard.embarkai.io/api";
|
|
25523
25588
|
}
|
|
25524
25589
|
function getSelectedNetwork() {
|
|
25525
25590
|
const paramNet = typeof window !== "undefined" ? (new URLSearchParams(window.location.search).get("network") || "").toLowerCase() : "";
|
|
@@ -25531,31 +25596,31 @@ function getExplorerUrl() {
|
|
|
25531
25596
|
const paramUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("explorerUrl") || void 0 : void 0;
|
|
25532
25597
|
const net = getSelectedNetwork();
|
|
25533
25598
|
const chainId = requireActiveChainId();
|
|
25534
|
-
const chainConfig = (0,
|
|
25599
|
+
const chainConfig = (0, import_read17.getChainConfig)(chainId);
|
|
25535
25600
|
console.log("[getExplorerUrl] ", paramUrl, chainConfig.blockExplorerUrl);
|
|
25536
25601
|
return paramUrl || chainConfig.blockExplorerUrl;
|
|
25537
25602
|
}
|
|
25538
25603
|
function getBundlerClient() {
|
|
25539
25604
|
const chainId = requireActiveChainId();
|
|
25540
|
-
const chainConfig = (0,
|
|
25541
|
-
const viemChain = (0,
|
|
25605
|
+
const chainConfig = (0, import_read17.getChainConfig)(chainId);
|
|
25606
|
+
const viemChain = (0, import_read17.getViemChain)(chainId);
|
|
25542
25607
|
return (0, import_account_abstraction2.createBundlerClient)({
|
|
25543
25608
|
chain: viemChain,
|
|
25544
25609
|
transport: (0, import_viem19.http)(chainConfig.bundlerUrl, { timeout: 1e4, retryCount: 0, fetchOptions: { mode: "cors" } })
|
|
25545
25610
|
});
|
|
25546
25611
|
}
|
|
25547
|
-
var
|
|
25612
|
+
var import_read17, import_viem19, import_account_abstraction2, BUILD_NETWORK, lumiaBeamTestnet, lumiaPrisma, FUNDER_PK;
|
|
25548
25613
|
var init_base = __esm({
|
|
25549
25614
|
"src/internal/clients/base.ts"() {
|
|
25550
25615
|
init_initial();
|
|
25551
25616
|
init_SessionContext();
|
|
25552
|
-
|
|
25617
|
+
import_read17 = require("@embarkai/core/read");
|
|
25553
25618
|
import_viem19 = require("viem");
|
|
25554
25619
|
import_account_abstraction2 = require("viem/account-abstraction");
|
|
25555
25620
|
init_env();
|
|
25556
25621
|
BUILD_NETWORK = true ? "" : "";
|
|
25557
|
-
lumiaBeamTestnet =
|
|
25558
|
-
lumiaPrisma =
|
|
25622
|
+
lumiaBeamTestnet = import_read17.lumiaTestnetChain;
|
|
25623
|
+
lumiaPrisma = import_read17.lumiaMainnetChain;
|
|
25559
25624
|
FUNDER_PK = getEnvVar("VITE_FUNDER_PK") || "";
|
|
25560
25625
|
}
|
|
25561
25626
|
});
|
|
@@ -27796,10 +27861,10 @@ var init_iframe_manager = __esm({
|
|
|
27796
27861
|
});
|
|
27797
27862
|
|
|
27798
27863
|
// src/config/rainbowkit.ts
|
|
27799
|
-
var
|
|
27864
|
+
var import_read18, import_rainbowkit3, import_wallets2, import_wagmi7, import_chains12, getProjectId2, WALLET_MAP, getWagmiStorageKey, buildRainbowChains, createRainbowConfig, rainbowTheme;
|
|
27800
27865
|
var init_rainbowkit = __esm({
|
|
27801
27866
|
"src/config/rainbowkit.ts"() {
|
|
27802
|
-
|
|
27867
|
+
import_read18 = require("@embarkai/core/read");
|
|
27803
27868
|
import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
27804
27869
|
import_wallets2 = require("@rainbow-me/rainbowkit/wallets");
|
|
27805
27870
|
import_wagmi7 = require("wagmi");
|
|
@@ -27824,8 +27889,8 @@ var init_rainbowkit = __esm({
|
|
|
27824
27889
|
};
|
|
27825
27890
|
buildRainbowChains = (supportedChains, preferredChainId) => {
|
|
27826
27891
|
const availableChains = [
|
|
27827
|
-
|
|
27828
|
-
|
|
27892
|
+
import_read18.lumiaMainnetChain,
|
|
27893
|
+
import_read18.lumiaTestnetChain,
|
|
27829
27894
|
import_chains12.mainnet,
|
|
27830
27895
|
import_chains12.polygon,
|
|
27831
27896
|
import_chains12.bsc,
|
|
@@ -28052,7 +28117,7 @@ var init_rainbowkit = __esm({
|
|
|
28052
28117
|
function RainbowKitProvider({ children }) {
|
|
28053
28118
|
const config = useProviderConfig().config;
|
|
28054
28119
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28055
|
-
const rainbowConfig = (0,
|
|
28120
|
+
const rainbowConfig = (0, import_react92.useMemo)(
|
|
28056
28121
|
() => createRainbowConfig({
|
|
28057
28122
|
projectId: config.current?.wallet?.walletConnectProjectId,
|
|
28058
28123
|
allowedWallets: config.current?.wallet?.allowedWallets,
|
|
@@ -28066,7 +28131,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28066
28131
|
config.current?.wallet?.walletConnectProjectId
|
|
28067
28132
|
]
|
|
28068
28133
|
);
|
|
28069
|
-
const customTheme = (0,
|
|
28134
|
+
const customTheme = (0, import_react92.useMemo)(() => {
|
|
28070
28135
|
if (!config.current?.wallet?.enabled) return {};
|
|
28071
28136
|
return colorMode === "dark" ? {
|
|
28072
28137
|
...(0, import_rainbowkit4.darkTheme)(),
|
|
@@ -28083,11 +28148,11 @@ function RainbowKitProvider({ children }) {
|
|
|
28083
28148
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_jsx_runtime124.Fragment, { children });
|
|
28084
28149
|
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_wagmi8.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28085
28150
|
}
|
|
28086
|
-
var import_rainbowkit4,
|
|
28151
|
+
var import_rainbowkit4, import_react92, import_wagmi8, import_styles, import_jsx_runtime124;
|
|
28087
28152
|
var init_RainbowKitContext = __esm({
|
|
28088
28153
|
"src/context/RainbowKitContext.tsx"() {
|
|
28089
28154
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
28090
|
-
|
|
28155
|
+
import_react92 = require("react");
|
|
28091
28156
|
import_wagmi8 = require("wagmi");
|
|
28092
28157
|
init_rainbowkit();
|
|
28093
28158
|
init_useLayoutStore();
|
|
@@ -28131,19 +28196,19 @@ function buildTransport(urls) {
|
|
|
28131
28196
|
retryCount: 0
|
|
28132
28197
|
});
|
|
28133
28198
|
}
|
|
28134
|
-
var
|
|
28199
|
+
var import_read19, import_viem20, import_wagmi9, import_chains13, wagmiConfig;
|
|
28135
28200
|
var init_wagmi = __esm({
|
|
28136
28201
|
"src/config/wagmi.ts"() {
|
|
28137
|
-
|
|
28202
|
+
import_read19 = require("@embarkai/core/read");
|
|
28138
28203
|
import_viem20 = require("viem");
|
|
28139
28204
|
import_wagmi9 = require("wagmi");
|
|
28140
28205
|
import_chains13 = require("wagmi/chains");
|
|
28141
28206
|
wagmiConfig = (0, import_wagmi9.createConfig)({
|
|
28142
|
-
chains: [
|
|
28207
|
+
chains: [import_read19.lumiaMainnetChain, import_read19.lumiaTestnetChain, import_chains13.bsc, import_chains13.mainnet],
|
|
28143
28208
|
storage: (0, import_wagmi9.createStorage)({ key: "embark-wagmi-static-v2" }),
|
|
28144
28209
|
transports: {
|
|
28145
|
-
[
|
|
28146
|
-
[
|
|
28210
|
+
[import_read19.lumiaTestnetChain.id]: buildTransport(import_read19.lumiaTestnetChain.rpcUrls.default.http),
|
|
28211
|
+
[import_read19.lumiaMainnetChain.id]: buildTransport(import_read19.lumiaMainnetChain.rpcUrls.default.http),
|
|
28147
28212
|
[import_chains13.bsc.id]: (0, import_wagmi9.http)(),
|
|
28148
28213
|
[import_chains13.mainnet.id]: (0, import_wagmi9.http)()
|
|
28149
28214
|
}
|
|
@@ -28182,10 +28247,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28182
28247
|
}
|
|
28183
28248
|
function Provider(props) {
|
|
28184
28249
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28185
|
-
const callbacksRef = (0,
|
|
28186
|
-
(0,
|
|
28187
|
-
const config = (0,
|
|
28188
|
-
const updateConfig = (0,
|
|
28250
|
+
const callbacksRef = (0, import_react93.useRef)(callbacks);
|
|
28251
|
+
(0, import_react93.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28252
|
+
const config = (0, import_react93.useRef)((0, import_lodash_es8.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28253
|
+
const updateConfig = (0, import_react93.useCallback)((updates) => {
|
|
28189
28254
|
const prev = config.current;
|
|
28190
28255
|
const next = { ...prev };
|
|
28191
28256
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28219,12 +28284,12 @@ function Provider(props) {
|
|
|
28219
28284
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28220
28285
|
config.current = next;
|
|
28221
28286
|
}, []);
|
|
28222
|
-
const updateCallbacks = (0,
|
|
28287
|
+
const updateCallbacks = (0, import_react93.useCallback)((updates) => {
|
|
28223
28288
|
const prev = callbacksRef.current;
|
|
28224
28289
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28225
28290
|
callbacksRef.current = next;
|
|
28226
28291
|
}, []);
|
|
28227
|
-
(0,
|
|
28292
|
+
(0, import_react93.useEffect)(() => {
|
|
28228
28293
|
if (typeof window === "undefined" || !projectId) return;
|
|
28229
28294
|
const mergedConfig = (0, import_lodash_es8.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28230
28295
|
updateConfig(mergedConfig);
|
|
@@ -28245,7 +28310,7 @@ function Provider(props) {
|
|
|
28245
28310
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28246
28311
|
}
|
|
28247
28312
|
}, [projectId, initialConfig]);
|
|
28248
|
-
(0,
|
|
28313
|
+
(0, import_react93.useEffect)(() => {
|
|
28249
28314
|
if (typeof window === "undefined" || !projectId) return;
|
|
28250
28315
|
try {
|
|
28251
28316
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -28274,7 +28339,7 @@ function Provider(props) {
|
|
|
28274
28339
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
28275
28340
|
}
|
|
28276
28341
|
}, [projectId]);
|
|
28277
|
-
const contextValue = (0,
|
|
28342
|
+
const contextValue = (0, import_react93.useMemo)(
|
|
28278
28343
|
() => ({
|
|
28279
28344
|
config,
|
|
28280
28345
|
updateConfig,
|
|
@@ -28289,12 +28354,12 @@ function Provider(props) {
|
|
|
28289
28354
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(RainbowKitProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SessionProvider, { children }) }) });
|
|
28290
28355
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SessionProvider, { children }) }) });
|
|
28291
28356
|
}
|
|
28292
|
-
var import_error_tracking4, import_lodash_es8,
|
|
28357
|
+
var import_error_tracking4, import_lodash_es8, import_react93, import_jsx_runtime126, UIContext, useProviderConfig;
|
|
28293
28358
|
var init_ProviderContext = __esm({
|
|
28294
28359
|
"src/context/ProviderContext.tsx"() {
|
|
28295
28360
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28296
28361
|
import_lodash_es8 = require("lodash-es");
|
|
28297
|
-
|
|
28362
|
+
import_react93 = require("react");
|
|
28298
28363
|
init_initial();
|
|
28299
28364
|
init_iframe_manager();
|
|
28300
28365
|
init_RainbowKitContext();
|
|
@@ -28302,9 +28367,9 @@ var init_ProviderContext = __esm({
|
|
|
28302
28367
|
init_utils11();
|
|
28303
28368
|
init_WagmiContext();
|
|
28304
28369
|
import_jsx_runtime126 = require("react/jsx-runtime");
|
|
28305
|
-
UIContext = (0,
|
|
28370
|
+
UIContext = (0, import_react93.createContext)(void 0);
|
|
28306
28371
|
useProviderConfig = () => {
|
|
28307
|
-
const ctx = (0,
|
|
28372
|
+
const ctx = (0, import_react93.useContext)(UIContext);
|
|
28308
28373
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
28309
28374
|
return ctx;
|
|
28310
28375
|
};
|
|
@@ -28407,9 +28472,102 @@ init_ProviderContext();
|
|
|
28407
28472
|
|
|
28408
28473
|
// src/components/ConnectWalletButton.tsx
|
|
28409
28474
|
init_LumiaIcon3();
|
|
28410
|
-
|
|
28475
|
+
|
|
28476
|
+
// src/internal/assets/wallets/EmbarkAiIcon.tsx
|
|
28477
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
28478
|
+
function EmbarkAiIcon(props) {
|
|
28479
|
+
const { width = "24", height = "24", ...svgProps } = props;
|
|
28480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
|
|
28481
|
+
"svg",
|
|
28482
|
+
{
|
|
28483
|
+
...svgProps,
|
|
28484
|
+
width,
|
|
28485
|
+
height,
|
|
28486
|
+
viewBox: "0 0 26 25",
|
|
28487
|
+
fill: "none",
|
|
28488
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
28489
|
+
style: { flexShrink: 0 },
|
|
28490
|
+
children: [
|
|
28491
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
28492
|
+
"path",
|
|
28493
|
+
{
|
|
28494
|
+
d: "M12.7045 5.8037H25.6717C25.6717 2.60055 23.1024 0 19.9298 0H6.96264C6.96264 3.20316 9.53194 5.8037 12.7045 5.8037Z",
|
|
28495
|
+
fill: "url(#paint0_radial_877_49)"
|
|
28496
|
+
}
|
|
28497
|
+
),
|
|
28498
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
28499
|
+
"path",
|
|
28500
|
+
{
|
|
28501
|
+
d: "M19.9333 9.59513H7.06557C7.06557 6.39197 4.49627 3.79143 1.32368 3.79143H0V9.59513H6.96265C6.96265 12.7983 9.53195 15.3988 12.7045 15.3988H25.6717C25.6717 12.1957 23.1024 9.59513 19.9298 9.59513H19.9333Z",
|
|
28502
|
+
fill: "url(#paint1_radial_877_49)"
|
|
28503
|
+
}
|
|
28504
|
+
),
|
|
28505
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
28506
|
+
"path",
|
|
28507
|
+
{
|
|
28508
|
+
d: "M19.9333 19.1938H7.06202C7.03008 16.0193 4.47498 13.4547 1.32368 13.4547H0V19.2584H6.9662C6.99814 22.4328 9.55324 24.9975 12.7045 24.9975H25.6717C25.6717 21.7943 23.1024 19.1938 19.9298 19.1938H19.9333Z",
|
|
28509
|
+
fill: "url(#paint2_radial_877_49)"
|
|
28510
|
+
}
|
|
28511
|
+
),
|
|
28512
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("defs", { children: [
|
|
28513
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
|
|
28514
|
+
"radialGradient",
|
|
28515
|
+
{
|
|
28516
|
+
id: "paint0_radial_877_49",
|
|
28517
|
+
cx: "0",
|
|
28518
|
+
cy: "0",
|
|
28519
|
+
r: "1",
|
|
28520
|
+
gradientUnits: "userSpaceOnUse",
|
|
28521
|
+
gradientTransform: "translate(25.2529 -0.939785) scale(26.7789 27.0672)",
|
|
28522
|
+
children: [
|
|
28523
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { stopColor: "#CCFFF8" }),
|
|
28524
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { offset: "0.36", stopColor: "#0DE4B3" }),
|
|
28525
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { offset: "1", stopColor: "#D13AFF" })
|
|
28526
|
+
]
|
|
28527
|
+
}
|
|
28528
|
+
),
|
|
28529
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
|
|
28530
|
+
"radialGradient",
|
|
28531
|
+
{
|
|
28532
|
+
id: "paint1_radial_877_49",
|
|
28533
|
+
cx: "0",
|
|
28534
|
+
cy: "0",
|
|
28535
|
+
r: "1",
|
|
28536
|
+
gradientUnits: "userSpaceOnUse",
|
|
28537
|
+
gradientTransform: "translate(23.6134 -2.08401) scale(30.1644 30.4892)",
|
|
28538
|
+
children: [
|
|
28539
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { stopColor: "#CCFFF8" }),
|
|
28540
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { offset: "0.36", stopColor: "#0DE4B3" }),
|
|
28541
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { offset: "1", stopColor: "#D13AFF" })
|
|
28542
|
+
]
|
|
28543
|
+
}
|
|
28544
|
+
),
|
|
28545
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
|
|
28546
|
+
"radialGradient",
|
|
28547
|
+
{
|
|
28548
|
+
id: "paint2_radial_877_49",
|
|
28549
|
+
cx: "0",
|
|
28550
|
+
cy: "0",
|
|
28551
|
+
r: "1",
|
|
28552
|
+
gradientUnits: "userSpaceOnUse",
|
|
28553
|
+
gradientTransform: "translate(16.0794 5.81084) scale(22.4849 22.727)",
|
|
28554
|
+
children: [
|
|
28555
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { stopColor: "#CCFFF8" }),
|
|
28556
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { offset: "0.36", stopColor: "#0DE4B3" }),
|
|
28557
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("stop", { offset: "1", stopColor: "#D13AFF" })
|
|
28558
|
+
]
|
|
28559
|
+
}
|
|
28560
|
+
)
|
|
28561
|
+
] })
|
|
28562
|
+
]
|
|
28563
|
+
}
|
|
28564
|
+
);
|
|
28565
|
+
}
|
|
28566
|
+
|
|
28567
|
+
// src/components/ConnectWalletButton.tsx
|
|
28568
|
+
var import_react_query56 = require("@tanstack/react-query");
|
|
28411
28569
|
var import_lucide_react80 = require("lucide-react");
|
|
28412
|
-
var
|
|
28570
|
+
var import_react94 = require("react");
|
|
28413
28571
|
init_SessionContext();
|
|
28414
28572
|
init_auth();
|
|
28415
28573
|
init_profile();
|
|
@@ -28420,7 +28578,7 @@ init_useLayoutDataStore();
|
|
|
28420
28578
|
init_useLayoutStore();
|
|
28421
28579
|
init_pro_mode();
|
|
28422
28580
|
init_utils2();
|
|
28423
|
-
var
|
|
28581
|
+
var import_jsx_runtime128 = (
|
|
28424
28582
|
/** external Buttons can be provided */
|
|
28425
28583
|
require("react/jsx-runtime")
|
|
28426
28584
|
);
|
|
@@ -28442,15 +28600,15 @@ function ConnectWalletButton(props) {
|
|
|
28442
28600
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28443
28601
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28444
28602
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28445
|
-
(0,
|
|
28446
|
-
const { data: profile, isLoading: isProfileLoading } = (0,
|
|
28603
|
+
(0, import_react94.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28604
|
+
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query56.useQuery)({
|
|
28447
28605
|
retry: false,
|
|
28448
28606
|
enabled: !!address,
|
|
28449
28607
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
28450
28608
|
queryFn: getUserProfile
|
|
28451
28609
|
});
|
|
28452
28610
|
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth21.jwtTokenManager.getDisplayName();
|
|
28453
|
-
const indicators = (0,
|
|
28611
|
+
const indicators = (0, import_react94.useMemo)(() => {
|
|
28454
28612
|
const userId = session?.mpcUserId;
|
|
28455
28613
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28456
28614
|
const server = import_auth21.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -28459,18 +28617,18 @@ function ConnectWalletButton(props) {
|
|
|
28459
28617
|
}, [session, address, hasServerVault]);
|
|
28460
28618
|
const proMode = useProMode();
|
|
28461
28619
|
const isConnecting = connectButtonLabel !== label || isLoading;
|
|
28462
|
-
return /* @__PURE__ */ (0,
|
|
28620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { "data-current-theme-mode": colorMode, className: cn("embarkai-ui-scope w-fit h-fit", className), children: !address ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_jsx_runtime128.Fragment, { children: ConnectButton ? /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
28463
28621
|
ConnectButton,
|
|
28464
28622
|
{
|
|
28465
28623
|
type: "button",
|
|
28466
28624
|
disabled: isConnecting,
|
|
28467
28625
|
onClick: () => setPage("auth" /* AUTH */),
|
|
28468
28626
|
children: [
|
|
28469
|
-
isConnecting
|
|
28627
|
+
isConnecting ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_lucide_react80.Loader, { className: "w-4 h-4 animate-spin" }) }) : /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(EmbarkAiIcon, { className: "w-6 h-6" }),
|
|
28470
28628
|
connectButtonLabel
|
|
28471
28629
|
]
|
|
28472
28630
|
}
|
|
28473
|
-
) : /* @__PURE__ */ (0,
|
|
28631
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
28474
28632
|
Button,
|
|
28475
28633
|
{
|
|
28476
28634
|
type: "button",
|
|
@@ -28480,18 +28638,18 @@ function ConnectWalletButton(props) {
|
|
|
28480
28638
|
onClick: () => setPage("auth" /* AUTH */),
|
|
28481
28639
|
className: cn(
|
|
28482
28640
|
"account-connect-button w-fit h-16 px-8",
|
|
28483
|
-
|
|
28641
|
+
"rounded-[var(--ui-kit-bdrs)]",
|
|
28484
28642
|
"border-0 border-transparent",
|
|
28485
28643
|
// to override button appearance bd, which case to case might drop black border
|
|
28486
28644
|
"bg-[var(--ui-kit-bg)] hover:bg-[var(--ui-kit-bg)] active:bg-[var(--ui-kit-bg)] text-[var(--ui-kit-fg)]",
|
|
28487
28645
|
"disabled:hover:bg-[var(--ui-kit-bg)] disabled:active:bg-[var(--ui-kit-bg)]"
|
|
28488
28646
|
),
|
|
28489
28647
|
children: [
|
|
28490
|
-
isConnecting
|
|
28648
|
+
isConnecting ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_lucide_react80.Loader, { className: "w-4 h-4 animate-spin" }) }) : /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(EmbarkAiIcon, { className: "w-6 h-6" }),
|
|
28491
28649
|
connectButtonLabel.toUpperCase()
|
|
28492
28650
|
]
|
|
28493
28651
|
}
|
|
28494
|
-
) }) : /* @__PURE__ */ (0,
|
|
28652
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
28495
28653
|
"button",
|
|
28496
28654
|
{
|
|
28497
28655
|
type: "button",
|
|
@@ -28504,26 +28662,26 @@ function ConnectWalletButton(props) {
|
|
|
28504
28662
|
"rounded-[var(--ui-kit-bdrs)] p-4 max-w-sm min-w-[256px]"
|
|
28505
28663
|
),
|
|
28506
28664
|
children: [
|
|
28507
|
-
/* @__PURE__ */ (0,
|
|
28508
|
-
proMode && /* @__PURE__ */ (0,
|
|
28509
|
-
profile?.avatar ? /* @__PURE__ */ (0,
|
|
28665
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "relative w-12 h-12 rounded-full bg-[var(--ui-kit-fg)] flex items-center justify-center flex-shrink-0", children: [
|
|
28666
|
+
proMode && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "absolute -top-1 -right-1 text-[8px] font-bold px-1 rounded bg-[var(--ui-kit-primary)] text-[var(--ui-kit-fg-inverted)] leading-3 z-10", children: "PRO" }),
|
|
28667
|
+
profile?.avatar ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("img", { src: profile.avatar, alt: "User avatar", className: "w-full h-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(LumiaIcon3, { width: 48, height: 48 })
|
|
28510
28668
|
] }),
|
|
28511
|
-
/* @__PURE__ */ (0,
|
|
28512
|
-
/* @__PURE__ */ (0,
|
|
28513
|
-
isProfileLoading ? /* @__PURE__ */ (0,
|
|
28514
|
-
!isProfileLoading && /* @__PURE__ */ (0,
|
|
28669
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "text-left flex-1 min-w-0 text-[var(--ui-kit-fg)]", children: [
|
|
28670
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
28671
|
+
isProfileLoading ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_lucide_react80.Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "w-fit text-[14px] leading-4 truncate max-w-[144px] text-[var(--ui-kit-fg)]", children: displayName }),
|
|
28672
|
+
!isProfileLoading && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(KYCStatus, {})
|
|
28515
28673
|
] }),
|
|
28516
|
-
/* @__PURE__ */ (0,
|
|
28674
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(BalanceView, {})
|
|
28517
28675
|
] }),
|
|
28518
|
-
/* @__PURE__ */ (0,
|
|
28519
|
-
/* @__PURE__ */ (0,
|
|
28520
|
-
/* @__PURE__ */ (0,
|
|
28676
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex items-center space-x-1", children: [
|
|
28677
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "group relative", children: [
|
|
28678
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
28521
28679
|
import_lucide_react80.Cloud,
|
|
28522
28680
|
{
|
|
28523
28681
|
className: `w-3 h-3 ${indicators.server ? "text-[var(--ui-kit-bg-success)]" : "text-[var(--ui-kit-bg-warning)]"}`
|
|
28524
28682
|
}
|
|
28525
28683
|
),
|
|
28526
|
-
/* @__PURE__ */ (0,
|
|
28684
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
28527
28685
|
"div",
|
|
28528
28686
|
{
|
|
28529
28687
|
className: cn(
|
|
@@ -28538,14 +28696,14 @@ function ConnectWalletButton(props) {
|
|
|
28538
28696
|
}
|
|
28539
28697
|
)
|
|
28540
28698
|
] }),
|
|
28541
|
-
/* @__PURE__ */ (0,
|
|
28542
|
-
/* @__PURE__ */ (0,
|
|
28699
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "group relative", children: [
|
|
28700
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
28543
28701
|
import_lucide_react80.Laptop,
|
|
28544
28702
|
{
|
|
28545
28703
|
className: `w-3 h-3 ${indicators.local ? "text-[var(--ui-kit-bg-success)]" : "text-[var(--ui-kit-bg-warning)]"}`
|
|
28546
28704
|
}
|
|
28547
28705
|
),
|
|
28548
|
-
/* @__PURE__ */ (0,
|
|
28706
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
28549
28707
|
"div",
|
|
28550
28708
|
{
|
|
28551
28709
|
className: cn(
|
|
@@ -28560,14 +28718,14 @@ function ConnectWalletButton(props) {
|
|
|
28560
28718
|
}
|
|
28561
28719
|
)
|
|
28562
28720
|
] }),
|
|
28563
|
-
/* @__PURE__ */ (0,
|
|
28564
|
-
/* @__PURE__ */ (0,
|
|
28721
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "group relative", children: [
|
|
28722
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
28565
28723
|
import_lucide_react80.Shield,
|
|
28566
28724
|
{
|
|
28567
28725
|
className: `w-3 h-3 ${indicators.backup ? "text-[var(--ui-kit-bg-success)]" : "text-[var(--ui-kit-bg-warning)]"}`
|
|
28568
28726
|
}
|
|
28569
28727
|
),
|
|
28570
|
-
/* @__PURE__ */ (0,
|
|
28728
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
28571
28729
|
"div",
|
|
28572
28730
|
{
|
|
28573
28731
|
className: cn(
|
|
@@ -28583,7 +28741,7 @@ function ConnectWalletButton(props) {
|
|
|
28583
28741
|
)
|
|
28584
28742
|
] })
|
|
28585
28743
|
] }),
|
|
28586
|
-
!!settingsNotifications.length && /* @__PURE__ */ (0,
|
|
28744
|
+
!!settingsNotifications.length && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
28587
28745
|
"div",
|
|
28588
28746
|
{
|
|
28589
28747
|
className: cn(
|
|
@@ -28632,7 +28790,7 @@ var useActiveChainId = () => useSession((st) => st.activeChainId);
|
|
|
28632
28790
|
var useHydrated = () => useSession((st) => st.hasHydrated);
|
|
28633
28791
|
|
|
28634
28792
|
// src/hooks/useOpenPage.ts
|
|
28635
|
-
var
|
|
28793
|
+
var import_react95 = require("react");
|
|
28636
28794
|
init_SessionContext();
|
|
28637
28795
|
init_useLayoutDataStore();
|
|
28638
28796
|
function useOpenPage() {
|
|
@@ -28640,7 +28798,7 @@ function useOpenPage() {
|
|
|
28640
28798
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
28641
28799
|
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
28642
28800
|
const address = useSession((st) => st.address);
|
|
28643
|
-
const open = (0,
|
|
28801
|
+
const open = (0, import_react95.useCallback)(
|
|
28644
28802
|
(passportPage, params) => {
|
|
28645
28803
|
if (!address) return setPage("auth" /* AUTH */);
|
|
28646
28804
|
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
@@ -28649,7 +28807,7 @@ function useOpenPage() {
|
|
|
28649
28807
|
},
|
|
28650
28808
|
[setPage, setPageParams, address]
|
|
28651
28809
|
);
|
|
28652
|
-
const close = (0,
|
|
28810
|
+
const close = (0, import_react95.useCallback)(() => setPage(null), [setPage]);
|
|
28653
28811
|
return { open, close, isOpen: page !== null };
|
|
28654
28812
|
}
|
|
28655
28813
|
|
|
@@ -28661,24 +28819,24 @@ var import_lucide_react81 = require("lucide-react");
|
|
|
28661
28819
|
init_useColorMode();
|
|
28662
28820
|
init_button();
|
|
28663
28821
|
init_utils2();
|
|
28664
|
-
var
|
|
28822
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
28665
28823
|
function ThemeToggle(props) {
|
|
28666
28824
|
const { className, ...btnProps } = props;
|
|
28667
28825
|
const { colorMode, setColorMode } = useColorMode();
|
|
28668
|
-
return /* @__PURE__ */ (0,
|
|
28826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
28669
28827
|
"div",
|
|
28670
28828
|
{
|
|
28671
28829
|
className: cn("embarkai-ui-scope", className),
|
|
28672
28830
|
"data-current-theme-mode": colorMode,
|
|
28673
28831
|
style: { width: "fit-content", height: "fit-content" },
|
|
28674
|
-
children: /* @__PURE__ */ (0,
|
|
28832
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
28675
28833
|
Button,
|
|
28676
28834
|
{
|
|
28677
28835
|
...btnProps,
|
|
28678
28836
|
variant: "ghost",
|
|
28679
28837
|
onClick: () => setColorMode(colorMode === "light" ? "dark" : "light"),
|
|
28680
28838
|
title: `Current theme: ${colorMode}. Click to switch.`,
|
|
28681
|
-
children: colorMode === "dark" ? /* @__PURE__ */ (0,
|
|
28839
|
+
children: colorMode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_lucide_react81.Sun, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_lucide_react81.Moon, { className: "w-4 h-4" })
|
|
28682
28840
|
}
|
|
28683
28841
|
)
|
|
28684
28842
|
}
|
|
@@ -28690,18 +28848,18 @@ init_i18n();
|
|
|
28690
28848
|
init_button();
|
|
28691
28849
|
init_useLayoutDataStore();
|
|
28692
28850
|
init_utils2();
|
|
28693
|
-
var
|
|
28851
|
+
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
28694
28852
|
function LangToggle(props) {
|
|
28695
28853
|
const { className, ...btnProps } = props;
|
|
28696
28854
|
const { i18n } = useT();
|
|
28697
28855
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
28698
|
-
return /* @__PURE__ */ (0,
|
|
28856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
28699
28857
|
"div",
|
|
28700
28858
|
{
|
|
28701
28859
|
className: cn("embarkai-ui-scope", className),
|
|
28702
28860
|
"data-mbark-language": i18n.resolvedLanguage || "en",
|
|
28703
28861
|
style: { width: "fit-content", height: "fit-content" },
|
|
28704
|
-
children: /* @__PURE__ */ (0,
|
|
28862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
28705
28863
|
Button,
|
|
28706
28864
|
{
|
|
28707
28865
|
...btnProps,
|
|
@@ -28725,10 +28883,10 @@ var React12 = __toESM(require("react"), 1);
|
|
|
28725
28883
|
// src/clients/bundler/getUserOperationByHash.ts
|
|
28726
28884
|
init_SessionContext();
|
|
28727
28885
|
var import_core3 = require("@embarkai/core");
|
|
28728
|
-
var
|
|
28886
|
+
var import_read20 = require("@embarkai/core/read");
|
|
28729
28887
|
async function getUserOperationByHash(userOpHash, chainId) {
|
|
28730
28888
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
28731
|
-
const chainConfig = (0,
|
|
28889
|
+
const chainConfig = (0, import_read20.getChainConfig)(targetChainId);
|
|
28732
28890
|
if (!chainConfig) {
|
|
28733
28891
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
28734
28892
|
}
|
|
@@ -28760,10 +28918,10 @@ async function getUserOperationByHash(userOpHash, chainId) {
|
|
|
28760
28918
|
// src/clients/bundler/getUserOperationReceipt.ts
|
|
28761
28919
|
init_SessionContext();
|
|
28762
28920
|
var import_core4 = require("@embarkai/core");
|
|
28763
|
-
var
|
|
28921
|
+
var import_read21 = require("@embarkai/core/read");
|
|
28764
28922
|
async function getUserOperationReceipt(userOpHash, chainId) {
|
|
28765
28923
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
28766
|
-
const chainConfig = (0,
|
|
28924
|
+
const chainConfig = (0, import_read21.getChainConfig)(targetChainId);
|
|
28767
28925
|
if (!chainConfig) {
|
|
28768
28926
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
28769
28927
|
}
|
|
@@ -28806,7 +28964,7 @@ var import_lucide_react82 = require("lucide-react");
|
|
|
28806
28964
|
var React11 = __toESM(require("react"), 1);
|
|
28807
28965
|
init_cn();
|
|
28808
28966
|
init_button();
|
|
28809
|
-
var
|
|
28967
|
+
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
28810
28968
|
function toExplorerAddressUrl(address, chain) {
|
|
28811
28969
|
const base2 = chain?.blockExplorers?.default?.url;
|
|
28812
28970
|
if (!base2) return null;
|
|
@@ -28828,11 +28986,11 @@ var Address = ({
|
|
|
28828
28986
|
const addr = address || "";
|
|
28829
28987
|
const explorer = toExplorerAddressUrl(addr, chain || void 0);
|
|
28830
28988
|
const [copied, setCopied] = React11.useState(false);
|
|
28831
|
-
if (!addr) return /* @__PURE__ */ (0,
|
|
28832
|
-
return /* @__PURE__ */ (0,
|
|
28833
|
-
label && /* @__PURE__ */ (0,
|
|
28834
|
-
/* @__PURE__ */ (0,
|
|
28835
|
-
showCopy && /* @__PURE__ */ (0,
|
|
28989
|
+
if (!addr) return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: cn2("text-muted-foreground", className), children: "\u2014" });
|
|
28990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: cn2("flex items-center gap-2", className), style: { listStyle: "none" }, children: [
|
|
28991
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "text-sm font-medium", children: label }),
|
|
28992
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("code", { className: "text-xs bg-background px-2 py-1 rounded select-all", children: truncate ? short(addr) : addr }),
|
|
28993
|
+
showCopy && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
28836
28994
|
Button,
|
|
28837
28995
|
{
|
|
28838
28996
|
variant: "ghost",
|
|
@@ -28846,10 +29004,10 @@ var Address = ({
|
|
|
28846
29004
|
} catch {
|
|
28847
29005
|
}
|
|
28848
29006
|
},
|
|
28849
|
-
children: /* @__PURE__ */ (0,
|
|
29007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_lucide_react82.Copy, { className: "h-4 w-4" })
|
|
28850
29008
|
}
|
|
28851
29009
|
),
|
|
28852
|
-
showExplorer && explorer && /* @__PURE__ */ (0,
|
|
29010
|
+
showExplorer && explorer && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
28853
29011
|
"a",
|
|
28854
29012
|
{
|
|
28855
29013
|
href: explorer,
|
|
@@ -28857,7 +29015,7 @@ var Address = ({
|
|
|
28857
29015
|
rel: "noreferrer noopener",
|
|
28858
29016
|
className: "inline-flex items-center justify-center h-10 w-10 rounded-md hover:bg-accent text-foreground",
|
|
28859
29017
|
title: "Open in explorer",
|
|
28860
|
-
children: /* @__PURE__ */ (0,
|
|
29018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_lucide_react82.ExternalLink, { className: "h-4 w-4" })
|
|
28861
29019
|
}
|
|
28862
29020
|
)
|
|
28863
29021
|
] });
|
|
@@ -28866,7 +29024,7 @@ var Address = ({
|
|
|
28866
29024
|
// src/internal/components/UserOpStatus.tsx
|
|
28867
29025
|
init_badge();
|
|
28868
29026
|
init_button();
|
|
28869
|
-
var
|
|
29027
|
+
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
28870
29028
|
var UserOpStatus = ({
|
|
28871
29029
|
userOpHash,
|
|
28872
29030
|
chain,
|
|
@@ -28981,35 +29139,35 @@ var UserOpStatus = ({
|
|
|
28981
29139
|
const stateBadge = () => {
|
|
28982
29140
|
if (receipt) {
|
|
28983
29141
|
const ok = !!receipt.success;
|
|
28984
|
-
return /* @__PURE__ */ (0,
|
|
28985
|
-
ok ? /* @__PURE__ */ (0,
|
|
29142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Badge, { variant: ok ? "success" : "destructive", children: [
|
|
29143
|
+
ok ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.CheckCircle2, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.AlertCircle, { className: "h-3 w-3" }),
|
|
28986
29144
|
ok ? "Included" : "Failed"
|
|
28987
29145
|
] });
|
|
28988
29146
|
}
|
|
28989
29147
|
if (rejected) {
|
|
28990
|
-
return /* @__PURE__ */ (0,
|
|
28991
|
-
/* @__PURE__ */ (0,
|
|
29148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Badge, { variant: "destructive", children: [
|
|
29149
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.AlertCircle, { className: "h-3 w-3" }),
|
|
28992
29150
|
" Rejected by bundler"
|
|
28993
29151
|
] });
|
|
28994
29152
|
}
|
|
28995
29153
|
if (timedOut) {
|
|
28996
|
-
return /* @__PURE__ */ (0,
|
|
28997
|
-
/* @__PURE__ */ (0,
|
|
29154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Badge, { variant: "warning", children: [
|
|
29155
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.AlertCircle, { className: "h-3 w-3" }),
|
|
28998
29156
|
" Timeout - may be rejected"
|
|
28999
29157
|
] });
|
|
29000
29158
|
}
|
|
29001
29159
|
if (mempool) {
|
|
29002
|
-
return /* @__PURE__ */ (0,
|
|
29003
|
-
/* @__PURE__ */ (0,
|
|
29160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Badge, { variant: "outline", children: [
|
|
29161
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.Clock, { className: "h-3 w-3" }),
|
|
29004
29162
|
" Pending in bundler"
|
|
29005
29163
|
] });
|
|
29006
29164
|
}
|
|
29007
|
-
return /* @__PURE__ */ (0,
|
|
29008
|
-
/* @__PURE__ */ (0,
|
|
29165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Badge, { variant: "secondary", children: [
|
|
29166
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.Clock, { className: "h-3 w-3" }),
|
|
29009
29167
|
" Waiting"
|
|
29010
29168
|
] });
|
|
29011
29169
|
};
|
|
29012
|
-
return /* @__PURE__ */ (0,
|
|
29170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
29013
29171
|
"div",
|
|
29014
29172
|
{
|
|
29015
29173
|
className: cn2(
|
|
@@ -29018,20 +29176,20 @@ var UserOpStatus = ({
|
|
|
29018
29176
|
),
|
|
29019
29177
|
style: { textAlign: "left", listStyle: "none" },
|
|
29020
29178
|
children: [
|
|
29021
|
-
/* @__PURE__ */ (0,
|
|
29022
|
-
/* @__PURE__ */ (0,
|
|
29179
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex items-center justify-between mb-3", children: [
|
|
29180
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
29023
29181
|
stateBadge(),
|
|
29024
|
-
/* @__PURE__ */ (0,
|
|
29182
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "text-xs text-muted-foreground", children: "This is a UserOperation hash (EIP-4337), not a L2 tx hash." })
|
|
29025
29183
|
] }),
|
|
29026
|
-
/* @__PURE__ */ (0,
|
|
29027
|
-
/* @__PURE__ */ (0,
|
|
29028
|
-
/* @__PURE__ */ (0,
|
|
29184
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Button, { variant: "ghost", size: "small", onClick: () => tick(), disabled: refreshing, className: "h-8", children: [
|
|
29185
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.RefreshCw, { className: cn2("h-3.5 w-3.5 mr-1", refreshing && "animate-spin") }),
|
|
29186
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "text-xs", children: "Refresh" })
|
|
29029
29187
|
] })
|
|
29030
29188
|
] }),
|
|
29031
|
-
/* @__PURE__ */ (0,
|
|
29032
|
-
/* @__PURE__ */ (0,
|
|
29033
|
-
/* @__PURE__ */ (0,
|
|
29034
|
-
/* @__PURE__ */ (0,
|
|
29189
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
29190
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "text-sm font-medium min-w-16 shrink-0", children: "UO Hash" }),
|
|
29191
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("code", { className: "text-xs font-mono flex-1 select-all", children: userOpHash }),
|
|
29192
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
29035
29193
|
Button,
|
|
29036
29194
|
{
|
|
29037
29195
|
variant: "ghost",
|
|
@@ -29043,14 +29201,14 @@ var UserOpStatus = ({
|
|
|
29043
29201
|
} catch {
|
|
29044
29202
|
}
|
|
29045
29203
|
},
|
|
29046
|
-
children: /* @__PURE__ */ (0,
|
|
29204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.Copy, { className: "h-3.5 w-3.5" })
|
|
29047
29205
|
}
|
|
29048
29206
|
)
|
|
29049
29207
|
] }),
|
|
29050
|
-
receipt && receipt.receipt?.transactionHash && /* @__PURE__ */ (0,
|
|
29051
|
-
/* @__PURE__ */ (0,
|
|
29052
|
-
/* @__PURE__ */ (0,
|
|
29053
|
-
/* @__PURE__ */ (0,
|
|
29208
|
+
receipt && receipt.receipt?.transactionHash && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex items-center gap-2 mb-3", children: [
|
|
29209
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "text-sm font-medium min-w-16 shrink-0", children: "Tx Hash" }),
|
|
29210
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("code", { className: "text-xs font-mono flex-1 select-all", children: receipt.receipt.transactionHash }),
|
|
29211
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
29054
29212
|
Button,
|
|
29055
29213
|
{
|
|
29056
29214
|
variant: "ghost",
|
|
@@ -29062,10 +29220,10 @@ var UserOpStatus = ({
|
|
|
29062
29220
|
} catch {
|
|
29063
29221
|
}
|
|
29064
29222
|
},
|
|
29065
|
-
children: /* @__PURE__ */ (0,
|
|
29223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.Copy, { className: "h-3.5 w-3.5" })
|
|
29066
29224
|
}
|
|
29067
29225
|
),
|
|
29068
|
-
chain?.blockExplorers?.default?.url && /* @__PURE__ */ (0,
|
|
29226
|
+
chain?.blockExplorers?.default?.url && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
29069
29227
|
"a",
|
|
29070
29228
|
{
|
|
29071
29229
|
href: `${chain.blockExplorers.default.url}/tx/${receipt.receipt.transactionHash}`,
|
|
@@ -29073,11 +29231,11 @@ var UserOpStatus = ({
|
|
|
29073
29231
|
rel: "noreferrer noopener",
|
|
29074
29232
|
className: "inline-flex items-center justify-center h-8 w-8 rounded-md hover:bg-accent text-foreground",
|
|
29075
29233
|
title: "Open in explorer",
|
|
29076
|
-
children: /* @__PURE__ */ (0,
|
|
29234
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.ExternalLink, { className: "h-3.5 w-3.5" })
|
|
29077
29235
|
}
|
|
29078
29236
|
)
|
|
29079
29237
|
] }),
|
|
29080
|
-
receipt && /* @__PURE__ */ (0,
|
|
29238
|
+
receipt && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "text-xs text-muted-foreground mb-3", children: [
|
|
29081
29239
|
"Block ",
|
|
29082
29240
|
parseInt(receipt.receipt?.blockNumber || "0x0", 16),
|
|
29083
29241
|
" \u2022 Gas Used",
|
|
@@ -29086,32 +29244,32 @@ var UserOpStatus = ({
|
|
|
29086
29244
|
" \u2022 Success ",
|
|
29087
29245
|
String(!!receipt.success)
|
|
29088
29246
|
] }),
|
|
29089
|
-
/* @__PURE__ */ (0,
|
|
29247
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "text-xs text-muted-foreground", children: !receipt && !timedOut && !rejected && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("span", { className: "ml-2", children: [
|
|
29090
29248
|
"\u2022 Polling for ",
|
|
29091
29249
|
Math.round((Date.now() - startTimeRef.current) / 1e3),
|
|
29092
29250
|
"s"
|
|
29093
29251
|
] }) }),
|
|
29094
|
-
mempool && /* @__PURE__ */ (0,
|
|
29095
|
-
/* @__PURE__ */ (0,
|
|
29252
|
+
mempool && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "text-sm text-muted-foreground mt-2", style: { listStyle: "none" }, children: [
|
|
29253
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { children: [
|
|
29096
29254
|
"Seen by bundler at ",
|
|
29097
|
-
/* @__PURE__ */ (0,
|
|
29255
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Address, { address: mempool.entryPoint, chain, showExplorer: true, truncate: false })
|
|
29098
29256
|
] }),
|
|
29099
|
-
/* @__PURE__ */ (0,
|
|
29257
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { children: [
|
|
29100
29258
|
"sender ",
|
|
29101
|
-
/* @__PURE__ */ (0,
|
|
29259
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Address, { address: mempool.sender, chain, truncate: false })
|
|
29102
29260
|
] })
|
|
29103
29261
|
] }),
|
|
29104
|
-
error && /* @__PURE__ */ (0,
|
|
29105
|
-
/* @__PURE__ */ (0,
|
|
29262
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
29263
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.AlertCircle, { className: "h-4 w-4" }),
|
|
29106
29264
|
" ",
|
|
29107
29265
|
error
|
|
29108
29266
|
] }),
|
|
29109
|
-
rejected && /* @__PURE__ */ (0,
|
|
29110
|
-
/* @__PURE__ */ (0,
|
|
29267
|
+
rejected && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
29268
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.AlertCircle, { className: "h-4 w-4" }),
|
|
29111
29269
|
"UserOperation was dropped from bundler mempool. This usually means it was invalid or replaced."
|
|
29112
29270
|
] }),
|
|
29113
|
-
timedOut && /* @__PURE__ */ (0,
|
|
29114
|
-
/* @__PURE__ */ (0,
|
|
29271
|
+
timedOut && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
29272
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react83.AlertCircle, { className: "h-4 w-4" }),
|
|
29115
29273
|
"Stopped polling after ",
|
|
29116
29274
|
Math.round(maxPollTimeMs / 1e3),
|
|
29117
29275
|
"s. UserOperation may have been rejected by the bundler."
|
|
@@ -29126,7 +29284,7 @@ var import_lucide_react84 = require("lucide-react");
|
|
|
29126
29284
|
var React13 = __toESM(require("react"), 1);
|
|
29127
29285
|
init_cn();
|
|
29128
29286
|
init_button();
|
|
29129
|
-
var
|
|
29287
|
+
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
29130
29288
|
function toExplorerUrl(kind, value, chain) {
|
|
29131
29289
|
const base2 = chain?.blockExplorers?.default?.url;
|
|
29132
29290
|
if (!base2) return null;
|
|
@@ -29150,11 +29308,11 @@ var Hash = ({
|
|
|
29150
29308
|
const value = hash || "";
|
|
29151
29309
|
const explorer = toExplorerUrl(kind, value, chain || void 0);
|
|
29152
29310
|
const [copied, setCopied] = React13.useState(false);
|
|
29153
|
-
if (!value) return /* @__PURE__ */ (0,
|
|
29154
|
-
return /* @__PURE__ */ (0,
|
|
29155
|
-
label && /* @__PURE__ */ (0,
|
|
29156
|
-
/* @__PURE__ */ (0,
|
|
29157
|
-
showCopy && /* @__PURE__ */ (0,
|
|
29311
|
+
if (!value) return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: cn2("text-muted-foreground", className), children: "\u2014" });
|
|
29312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: cn2("flex items-center gap-2", className), children: [
|
|
29313
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "text-sm font-medium", children: label }),
|
|
29314
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("code", { className: "text-xs bg-background px-2 py-1 rounded break-all", children: truncate ? short2(value) : value }),
|
|
29315
|
+
showCopy && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
29158
29316
|
Button,
|
|
29159
29317
|
{
|
|
29160
29318
|
variant: "ghost",
|
|
@@ -29168,10 +29326,10 @@ var Hash = ({
|
|
|
29168
29326
|
} catch {
|
|
29169
29327
|
}
|
|
29170
29328
|
},
|
|
29171
|
-
children: /* @__PURE__ */ (0,
|
|
29329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_lucide_react84.Copy, { className: "h-4 w-4" })
|
|
29172
29330
|
}
|
|
29173
29331
|
),
|
|
29174
|
-
showExplorer && explorer && /* @__PURE__ */ (0,
|
|
29332
|
+
showExplorer && explorer && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
29175
29333
|
"a",
|
|
29176
29334
|
{
|
|
29177
29335
|
href: explorer,
|
|
@@ -29179,21 +29337,21 @@ var Hash = ({
|
|
|
29179
29337
|
rel: "noreferrer noopener",
|
|
29180
29338
|
className: "inline-flex items-center justify-center h-10 w-10 rounded-md hover:bg-accent text-foreground",
|
|
29181
29339
|
title: "Open in explorer",
|
|
29182
|
-
children: /* @__PURE__ */ (0,
|
|
29340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_lucide_react84.ExternalLink, { className: "h-4 w-4" })
|
|
29183
29341
|
}
|
|
29184
29342
|
)
|
|
29185
29343
|
] });
|
|
29186
29344
|
};
|
|
29187
29345
|
|
|
29188
29346
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
29189
|
-
var
|
|
29347
|
+
var import_react96 = require("react");
|
|
29190
29348
|
init_base();
|
|
29191
|
-
var
|
|
29349
|
+
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
29192
29350
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
29193
|
-
const [transactions, setTransactions] = (0,
|
|
29194
|
-
const [loading, setLoading] = (0,
|
|
29195
|
-
const [error, setError] = (0,
|
|
29196
|
-
(0,
|
|
29351
|
+
const [transactions, setTransactions] = (0, import_react96.useState)([]);
|
|
29352
|
+
const [loading, setLoading] = (0, import_react96.useState)(true);
|
|
29353
|
+
const [error, setError] = (0, import_react96.useState)(null);
|
|
29354
|
+
(0, import_react96.useEffect)(() => {
|
|
29197
29355
|
const fetchTransactions2 = async () => {
|
|
29198
29356
|
try {
|
|
29199
29357
|
setLoading(true);
|
|
@@ -29239,31 +29397,31 @@ var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
|
29239
29397
|
window.open(`${explorerUrl}/tx/${txHash}`, "_blank");
|
|
29240
29398
|
};
|
|
29241
29399
|
if (loading) {
|
|
29242
|
-
return /* @__PURE__ */ (0,
|
|
29243
|
-
/* @__PURE__ */ (0,
|
|
29244
|
-
/* @__PURE__ */ (0,
|
|
29400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "p-4 text-center", children: [
|
|
29401
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "animate-spin inline-block w-6 h-6 border-2 border-current border-t-transparent rounded-full" }),
|
|
29402
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: "Loading transactions..." })
|
|
29245
29403
|
] });
|
|
29246
29404
|
}
|
|
29247
29405
|
if (error) {
|
|
29248
|
-
return /* @__PURE__ */ (0,
|
|
29249
|
-
/* @__PURE__ */ (0,
|
|
29250
|
-
/* @__PURE__ */ (0,
|
|
29406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "p-4 text-center", children: [
|
|
29407
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-red-600 text-sm", children: error }),
|
|
29408
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("button", { onClick: () => window.location.reload(), className: "mt-2 text-blue-600 text-sm hover:underline", children: "Retry" })
|
|
29251
29409
|
] });
|
|
29252
29410
|
}
|
|
29253
29411
|
if (transactions.length === 0) {
|
|
29254
|
-
return /* @__PURE__ */ (0,
|
|
29412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "p-4 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-gray-600 text-sm", children: "No transactions found" }) });
|
|
29255
29413
|
}
|
|
29256
|
-
return /* @__PURE__ */ (0,
|
|
29414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "max-h-96 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "space-y-2 p-2", children: transactions.map((tx) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
29257
29415
|
"div",
|
|
29258
29416
|
{
|
|
29259
29417
|
className: "border rounded-lg p-3 hover:bg-gray-50 cursor-pointer transition-colors",
|
|
29260
29418
|
onClick: () => openTransaction(tx.hash),
|
|
29261
29419
|
children: [
|
|
29262
|
-
/* @__PURE__ */ (0,
|
|
29263
|
-
/* @__PURE__ */ (0,
|
|
29264
|
-
/* @__PURE__ */ (0,
|
|
29265
|
-
/* @__PURE__ */ (0,
|
|
29266
|
-
/* @__PURE__ */ (0,
|
|
29420
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex justify-between items-start mb-2", children: [
|
|
29421
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex-1", children: [
|
|
29422
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex items-center space-x-2 mb-1", children: [
|
|
29423
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-xs font-mono bg-gray-100 px-2 py-1 rounded", children: formatAddress3(tx.hash) }),
|
|
29424
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
29267
29425
|
"span",
|
|
29268
29426
|
{
|
|
29269
29427
|
className: `text-xs px-2 py-1 rounded ${tx.status === "ok" ? "bg-green-100 text-green-800" : "bg-red-100 text-red-800"}`,
|
|
@@ -29271,40 +29429,40 @@ var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
|
29271
29429
|
}
|
|
29272
29430
|
)
|
|
29273
29431
|
] }),
|
|
29274
|
-
/* @__PURE__ */ (0,
|
|
29275
|
-
/* @__PURE__ */ (0,
|
|
29276
|
-
/* @__PURE__ */ (0,
|
|
29277
|
-
/* @__PURE__ */ (0,
|
|
29432
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "text-sm space-y-1", children: [
|
|
29433
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { children: [
|
|
29434
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-gray-600", children: "From:" }),
|
|
29435
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "font-mono ml-1", children: [
|
|
29278
29436
|
formatAddress3(tx.from.hash),
|
|
29279
|
-
tx.from.is_contract && /* @__PURE__ */ (0,
|
|
29437
|
+
tx.from.is_contract && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-xs text-blue-600 ml-1", children: "(Contract)" })
|
|
29280
29438
|
] })
|
|
29281
29439
|
] }),
|
|
29282
|
-
/* @__PURE__ */ (0,
|
|
29283
|
-
/* @__PURE__ */ (0,
|
|
29284
|
-
/* @__PURE__ */ (0,
|
|
29440
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { children: [
|
|
29441
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-gray-600", children: "To:" }),
|
|
29442
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "font-mono ml-1", children: [
|
|
29285
29443
|
formatAddress3(tx.to.hash),
|
|
29286
|
-
tx.to.is_contract && /* @__PURE__ */ (0,
|
|
29444
|
+
tx.to.is_contract && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-xs text-blue-600 ml-1", children: "(Contract)" })
|
|
29287
29445
|
] })
|
|
29288
29446
|
] }),
|
|
29289
|
-
/* @__PURE__ */ (0,
|
|
29290
|
-
/* @__PURE__ */ (0,
|
|
29291
|
-
/* @__PURE__ */ (0,
|
|
29447
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { children: [
|
|
29448
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-gray-600", children: "Value:" }),
|
|
29449
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "font-semibold ml-1", children: [
|
|
29292
29450
|
formatValue3(tx.value),
|
|
29293
29451
|
" LUMIA"
|
|
29294
29452
|
] })
|
|
29295
29453
|
] })
|
|
29296
29454
|
] })
|
|
29297
29455
|
] }),
|
|
29298
|
-
/* @__PURE__ */ (0,
|
|
29299
|
-
/* @__PURE__ */ (0,
|
|
29300
|
-
/* @__PURE__ */ (0,
|
|
29456
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "text-right text-xs text-gray-500", children: [
|
|
29457
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { children: formatDate2(tx.timestamp) }),
|
|
29458
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "mt-1", children: [
|
|
29301
29459
|
"Gas: ",
|
|
29302
29460
|
parseInt(tx.gas_used).toLocaleString()
|
|
29303
29461
|
] }),
|
|
29304
|
-
tx.method && /* @__PURE__ */ (0,
|
|
29462
|
+
tx.method && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-1 text-blue-600", children: tx.method })
|
|
29305
29463
|
] })
|
|
29306
29464
|
] }),
|
|
29307
|
-
tx.transaction_types.length > 0 && /* @__PURE__ */ (0,
|
|
29465
|
+
tx.transaction_types.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "flex flex-wrap gap-1 mt-2", children: tx.transaction_types.map((type, idx) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full", children: type.replace("_", " ") }, idx)) })
|
|
29308
29466
|
]
|
|
29309
29467
|
},
|
|
29310
29468
|
tx.hash
|
|
@@ -29514,13 +29672,13 @@ function useUserOpStatus(options = {}) {
|
|
|
29514
29672
|
init_useErc3643Compliance();
|
|
29515
29673
|
|
|
29516
29674
|
// src/hooks/useWalletMode.ts
|
|
29517
|
-
var
|
|
29675
|
+
var import_react97 = require("react");
|
|
29518
29676
|
init_useExternalWalletStore();
|
|
29519
29677
|
function useWalletMode() {
|
|
29520
29678
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29521
29679
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29522
29680
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29523
|
-
const switchMode = (0,
|
|
29681
|
+
const switchMode = (0, import_react97.useCallback)(
|
|
29524
29682
|
(mode) => {
|
|
29525
29683
|
if (configMode !== "both") return;
|
|
29526
29684
|
setActiveMode(mode);
|
|
@@ -29536,7 +29694,7 @@ function useWalletMode() {
|
|
|
29536
29694
|
}
|
|
29537
29695
|
|
|
29538
29696
|
// src/hooks/useDirectWallet.ts
|
|
29539
|
-
var
|
|
29697
|
+
var import_react98 = require("react");
|
|
29540
29698
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29541
29699
|
var import_wagmi12 = require("wagmi");
|
|
29542
29700
|
init_useExternalWalletStore();
|
|
@@ -29550,13 +29708,13 @@ function useDirectWallet() {
|
|
|
29550
29708
|
const { disconnect: wagmiDisconnect } = (0, import_wagmi12.useDisconnect)();
|
|
29551
29709
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29552
29710
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29553
|
-
const connect = (0,
|
|
29711
|
+
const connect = (0, import_react98.useCallback)(() => {
|
|
29554
29712
|
setIsWalletLinking(true);
|
|
29555
29713
|
}, [setIsWalletLinking]);
|
|
29556
|
-
const reconnect = (0,
|
|
29714
|
+
const reconnect = (0, import_react98.useCallback)(() => {
|
|
29557
29715
|
if (openConnectModal) openConnectModal();
|
|
29558
29716
|
}, [openConnectModal]);
|
|
29559
|
-
const disconnect = (0,
|
|
29717
|
+
const disconnect = (0, import_react98.useCallback)(() => {
|
|
29560
29718
|
wagmiDisconnect();
|
|
29561
29719
|
clearExternalWallet();
|
|
29562
29720
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29572,7 +29730,7 @@ function useDirectWallet() {
|
|
|
29572
29730
|
}
|
|
29573
29731
|
|
|
29574
29732
|
// src/hooks/useSendDirectTransaction.ts
|
|
29575
|
-
var
|
|
29733
|
+
var import_react99 = require("react");
|
|
29576
29734
|
var import_viem21 = require("viem");
|
|
29577
29735
|
var import_wagmi13 = require("wagmi");
|
|
29578
29736
|
init_useExternalWalletStore();
|
|
@@ -29581,10 +29739,10 @@ function useSendDirectTransaction() {
|
|
|
29581
29739
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29582
29740
|
const { sendTransactionAsync } = (0, import_wagmi13.useSendTransaction)();
|
|
29583
29741
|
const { switchChainAsync } = (0, import_wagmi13.useSwitchChain)();
|
|
29584
|
-
const [isPending, setIsPending] = (0,
|
|
29585
|
-
const [error, setError] = (0,
|
|
29586
|
-
const [txHash, setTxHash] = (0,
|
|
29587
|
-
const sendTransaction = (0,
|
|
29742
|
+
const [isPending, setIsPending] = (0, import_react99.useState)(false);
|
|
29743
|
+
const [error, setError] = (0, import_react99.useState)(null);
|
|
29744
|
+
const [txHash, setTxHash] = (0, import_react99.useState)(null);
|
|
29745
|
+
const sendTransaction = (0, import_react99.useCallback)(
|
|
29588
29746
|
async (params) => {
|
|
29589
29747
|
if (!isConnected) {
|
|
29590
29748
|
setError("No external wallet connected");
|
|
@@ -29618,7 +29776,7 @@ function useSendDirectTransaction() {
|
|
|
29618
29776
|
},
|
|
29619
29777
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29620
29778
|
);
|
|
29621
|
-
const reset = (0,
|
|
29779
|
+
const reset = (0, import_react99.useCallback)(() => {
|
|
29622
29780
|
setError(null);
|
|
29623
29781
|
setTxHash(null);
|
|
29624
29782
|
setIsPending(false);
|
|
@@ -29627,7 +29785,7 @@ function useSendDirectTransaction() {
|
|
|
29627
29785
|
}
|
|
29628
29786
|
|
|
29629
29787
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
29630
|
-
var
|
|
29788
|
+
var import_react100 = require("react");
|
|
29631
29789
|
var import_viem22 = require("viem");
|
|
29632
29790
|
init_SessionContext();
|
|
29633
29791
|
init_account2();
|
|
@@ -29646,14 +29804,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29646
29804
|
function useTransferToLinkedWallet() {
|
|
29647
29805
|
const session = useSession((st) => st.session);
|
|
29648
29806
|
const { profiles } = useLinkedProfiles();
|
|
29649
|
-
const [isPending, setIsPending] = (0,
|
|
29650
|
-
const [error, setError] = (0,
|
|
29651
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
29652
|
-
const linkedWallets = (0,
|
|
29807
|
+
const [isPending, setIsPending] = (0, import_react100.useState)(false);
|
|
29808
|
+
const [error, setError] = (0, import_react100.useState)(null);
|
|
29809
|
+
const [userOpHash, setUserOpHash] = (0, import_react100.useState)(null);
|
|
29810
|
+
const linkedWallets = (0, import_react100.useMemo)(
|
|
29653
29811
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29654
29812
|
[profiles]
|
|
29655
29813
|
);
|
|
29656
|
-
const transfer = (0,
|
|
29814
|
+
const transfer = (0, import_react100.useCallback)(
|
|
29657
29815
|
async (params) => {
|
|
29658
29816
|
if (!session) {
|
|
29659
29817
|
setError("No active session");
|
|
@@ -29704,7 +29862,7 @@ function useTransferToLinkedWallet() {
|
|
|
29704
29862
|
},
|
|
29705
29863
|
[session, linkedWallets]
|
|
29706
29864
|
);
|
|
29707
|
-
const reset = (0,
|
|
29865
|
+
const reset = (0, import_react100.useCallback)(() => {
|
|
29708
29866
|
setError(null);
|
|
29709
29867
|
setUserOpHash(null);
|
|
29710
29868
|
setIsPending(false);
|
|
@@ -29728,13 +29886,13 @@ function useNativeWalletSignature() {
|
|
|
29728
29886
|
|
|
29729
29887
|
// src/hooks/useLogout.ts
|
|
29730
29888
|
var import_auth23 = require("@embarkai/core/auth");
|
|
29731
|
-
var
|
|
29889
|
+
var import_react101 = require("react");
|
|
29732
29890
|
init_ProviderContext();
|
|
29733
29891
|
init_SessionContext();
|
|
29734
29892
|
function useLogout() {
|
|
29735
29893
|
const { setSession, setIsLoading, setAddress, setStatus, setError, address } = useSession();
|
|
29736
29894
|
const { callbacksRef } = useProviderConfig();
|
|
29737
|
-
const logout2 = (0,
|
|
29895
|
+
const logout2 = (0, import_react101.useCallback)(async () => {
|
|
29738
29896
|
const prevAddress = address;
|
|
29739
29897
|
let userId = null;
|
|
29740
29898
|
setIsLoading(true);
|
|
@@ -29780,12 +29938,12 @@ init_useBlockscoutAssets();
|
|
|
29780
29938
|
|
|
29781
29939
|
// src/modules/transactions.ts
|
|
29782
29940
|
init_SessionContext();
|
|
29783
|
-
var
|
|
29941
|
+
var import_read22 = require("@embarkai/core/read");
|
|
29784
29942
|
var import_viem23 = require("viem");
|
|
29785
29943
|
var import_wagmi15 = require("wagmi");
|
|
29786
29944
|
function useTransactions() {
|
|
29787
29945
|
const chainId = requireActiveChainId();
|
|
29788
|
-
const viemChain = (0,
|
|
29946
|
+
const viemChain = (0, import_read22.getViemChain)(chainId);
|
|
29789
29947
|
const publicClient = (0, import_wagmi15.usePublicClient)({ chainId });
|
|
29790
29948
|
const { data: walletClient } = (0, import_wagmi15.useWalletClient)();
|
|
29791
29949
|
const { address } = (0, import_wagmi15.useAccount)();
|
|
@@ -29846,7 +30004,7 @@ function useTransactions() {
|
|
|
29846
30004
|
|
|
29847
30005
|
// src/modules/assets.ts
|
|
29848
30006
|
init_SessionContext();
|
|
29849
|
-
var
|
|
30007
|
+
var import_react102 = __toESM(require("react"), 1);
|
|
29850
30008
|
var import_viem24 = require("viem");
|
|
29851
30009
|
var import_wagmi16 = require("wagmi");
|
|
29852
30010
|
var COMMON_TOKENS = [
|
|
@@ -30002,7 +30160,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
30002
30160
|
}
|
|
30003
30161
|
});
|
|
30004
30162
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
30005
|
-
const formattedBalance =
|
|
30163
|
+
const formattedBalance = import_react102.default.useMemo(() => {
|
|
30006
30164
|
if (!balance || !tokenInfo) return "0";
|
|
30007
30165
|
return (0, import_viem24.formatUnits)(balance, tokenInfo.decimals);
|
|
30008
30166
|
}, [balance, tokenInfo]);
|