@embarkai/ui-kit 0.4.77 → 0.4.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +35 -27
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +38 -30
- package/package.json +1 -1
package/dist/iframe/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<meta http-equiv="X-Content-Type-Options" content="nosniff" />
|
|
16
16
|
<meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
|
|
17
17
|
|
|
18
|
-
<title>EmbarkAI Secure Wallet - iframe version 0.4.
|
|
18
|
+
<title>EmbarkAI Secure Wallet - iframe version 0.4.78</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -6414,7 +6414,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
6414
6414
|
};
|
|
6415
6415
|
|
|
6416
6416
|
// src/iframe/main.ts
|
|
6417
|
-
var IFRAME_VERSION = "0.4.
|
|
6417
|
+
var IFRAME_VERSION = "0.4.78";
|
|
6418
6418
|
var IframeWallet = class {
|
|
6419
6419
|
constructor() {
|
|
6420
6420
|
__publicField(this, "messenger");
|
package/dist/index.cjs
CHANGED
|
@@ -168,13 +168,14 @@ var init_initial = __esm({
|
|
|
168
168
|
authOrder: ["email", "social", "wallet"]
|
|
169
169
|
},
|
|
170
170
|
network: {
|
|
171
|
-
name: import_read.
|
|
172
|
-
symbol: import_read.
|
|
173
|
-
chainId: import_read.
|
|
174
|
-
rpcUrl: import_read.
|
|
175
|
-
explorerUrl: import_read.
|
|
176
|
-
testnet:
|
|
177
|
-
forceChain: false
|
|
171
|
+
name: import_read.LUMIA_MAINNET.name,
|
|
172
|
+
symbol: import_read.LUMIA_MAINNET.nativeCurrency.symbol,
|
|
173
|
+
chainId: import_read.LUMIA_MAINNET.id,
|
|
174
|
+
rpcUrl: import_read.LUMIA_MAINNET.rpcUrls[0],
|
|
175
|
+
explorerUrl: import_read.LUMIA_MAINNET.blockExplorerUrl,
|
|
176
|
+
testnet: false,
|
|
177
|
+
forceChain: false,
|
|
178
|
+
autoswitch: false
|
|
178
179
|
},
|
|
179
180
|
services: {
|
|
180
181
|
tssUrl: "",
|
|
@@ -1378,7 +1379,7 @@ function ChainSync() {
|
|
|
1378
1379
|
}, [address, activeChainId]);
|
|
1379
1380
|
(0, import_react2.useEffect)(() => {
|
|
1380
1381
|
if (!address || !activeChainId) return;
|
|
1381
|
-
const shouldSwitchRequest = !config.current?.network?.forceChain && activeChainId !== config.current?.network?.chainId;
|
|
1382
|
+
const shouldSwitchRequest = !config.current?.network?.forceChain && !!config.current?.network?.autoswitch && activeChainId !== config.current?.network?.chainId;
|
|
1382
1383
|
async function showSwitchChainRequest() {
|
|
1383
1384
|
const stats = await getShareRecoveryStats();
|
|
1384
1385
|
const hasRecoveryData = !!stats && (!!stats.created || stats.devices && stats.devices.length > 0);
|
|
@@ -21677,9 +21678,10 @@ function getAssetBalance(asset) {
|
|
|
21677
21678
|
return Number((0, import_viem13.formatUnits)(BigInt(asset.balance || "0"), asset.decimals || 18));
|
|
21678
21679
|
}
|
|
21679
21680
|
function isOririnChainEmbarkSupported(originChain) {
|
|
21680
|
-
const
|
|
21681
|
-
|
|
21682
|
-
|
|
21681
|
+
const originChainID = CHAINS_UI_META[originChain]?.chainID;
|
|
21682
|
+
if (!originChainID) return false;
|
|
21683
|
+
const supportedChainIDS = [...import_read20.SUPPORTED_CHAINS].map(([chainId]) => chainId);
|
|
21684
|
+
return supportedChainIDS.includes(originChainID) && useSession.getState().activeChainId === originChainID;
|
|
21683
21685
|
}
|
|
21684
21686
|
var import_read20, import_viem13;
|
|
21685
21687
|
var init_utils9 = __esm({
|
|
@@ -21973,11 +21975,7 @@ function useHyperlaneRoutes() {
|
|
|
21973
21975
|
retry: false,
|
|
21974
21976
|
enabled: !!address && page === "send" /* SEND */ && flow === "bridge",
|
|
21975
21977
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
21976
|
-
queryFn: async () =>
|
|
21977
|
-
const warpRoutes = await getHyperlaneWarpRoutes();
|
|
21978
|
-
useFlowSelectorStore.getState().setRenderKey(`hyperlane-bridge-warp-routes-loaded-${Date.now()}`);
|
|
21979
|
-
return warpRoutes;
|
|
21980
|
-
}
|
|
21978
|
+
queryFn: async () => await getHyperlaneWarpRoutes()
|
|
21981
21979
|
});
|
|
21982
21980
|
(0, import_react72.useEffect)(() => {
|
|
21983
21981
|
if (!errorWarpRoutes) return;
|
|
@@ -21990,20 +21988,30 @@ function useHyperlaneRoutes() {
|
|
|
21990
21988
|
}, [errorWarpRoutes]);
|
|
21991
21989
|
(0, import_react72.useEffect)(() => {
|
|
21992
21990
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
21993
|
-
|
|
21994
|
-
if (!
|
|
21991
|
+
let targetHyperRouteToSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
21992
|
+
if (!targetHyperRouteToSelect) {
|
|
21993
|
+
targetHyperRouteToSelect = hyperlaneWarpRoutes.find(
|
|
21994
|
+
(el) => el.symbol === (useSession.getState().chainConfig?.nativeCurrency?.symbol || "USDT")
|
|
21995
|
+
);
|
|
21996
|
+
}
|
|
21997
|
+
if (!targetHyperRouteToSelect) {
|
|
21998
|
+
useFlowSelectorStore.getState().setRenderKey(`no-hyperlane-bridge-warp-routes-loaded-${Date.now()}`);
|
|
21999
|
+
return;
|
|
22000
|
+
}
|
|
21995
22001
|
let originChainIndex = 0;
|
|
21996
22002
|
let destinationChainIndex = 1;
|
|
21997
|
-
|
|
21998
|
-
|
|
22003
|
+
const { bridgeSender, setOriginChain, setDestinationChain, setHyperRoute } = useBridgeStore.getState();
|
|
22004
|
+
if (bridgeSender === "embarkai-wallet") {
|
|
22005
|
+
const foundIdx = targetHyperRouteToSelect.chainPair?.findIndex((chain) => isOririnChainEmbarkSupported(chain.chainName)) || -1;
|
|
21999
22006
|
if (foundIdx !== -1) {
|
|
22000
22007
|
originChainIndex = foundIdx;
|
|
22001
22008
|
destinationChainIndex = foundIdx === 0 ? 1 : 0;
|
|
22002
22009
|
}
|
|
22003
22010
|
}
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
|
|
22011
|
+
setOriginChain(targetHyperRouteToSelect.chainPair[originChainIndex].chainName);
|
|
22012
|
+
setDestinationChain(targetHyperRouteToSelect.chainPair[destinationChainIndex].chainName);
|
|
22013
|
+
setHyperRoute(targetHyperRouteToSelect.routeId);
|
|
22014
|
+
useFlowSelectorStore.getState().setRenderKey(`hyperlane-bridge-warp-routes-loaded-${Date.now()}`);
|
|
22007
22015
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
22008
22016
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
22009
22017
|
}
|
|
@@ -22357,7 +22365,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
22357
22365
|
break;
|
|
22358
22366
|
}
|
|
22359
22367
|
}, [bridgeSender, originChain, directWalletChainId, switchChainAsync]);
|
|
22360
|
-
const embarkBalance = CHAINS_UI_META[originChain]
|
|
22368
|
+
const embarkBalance = !!embarkTokenBalanace && CHAINS_UI_META[originChain]?.chainID === activeChainId ? getAssetBalance(embarkTokenBalanace) : 0;
|
|
22361
22369
|
const externalWalletBalance = isSelectedTokenNative ? (0, import_viem14.formatUnits)(externalNativeBalanceData?.value || BigInt(0), externalNativeBalanceData?.decimals || 18) : (0, import_viem14.formatUnits)(externalBalanceData?.value || BigInt(0), externalBalanceData?.decimals || 18);
|
|
22362
22370
|
return {
|
|
22363
22371
|
routeTokenBalance: isEmbarkSender ? embarkBalance : externalWalletBalance,
|
|
@@ -26345,7 +26353,7 @@ var init_package = __esm({
|
|
|
26345
26353
|
"package.json"() {
|
|
26346
26354
|
package_default = {
|
|
26347
26355
|
name: "@embarkai/ui-kit",
|
|
26348
|
-
version: "0.4.
|
|
26356
|
+
version: "0.4.78",
|
|
26349
26357
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
26350
26358
|
type: "module",
|
|
26351
26359
|
main: "./dist/index.cjs",
|
|
@@ -27595,7 +27603,7 @@ var init_SessionContext = __esm({
|
|
|
27595
27603
|
// Set default chainId after hydration if not persisted
|
|
27596
27604
|
onRehydrateStorage: () => (state) => {
|
|
27597
27605
|
if (!state) return;
|
|
27598
|
-
const hydartedChain = getChainParams((0, import_read22.getChainConfig)(state.activeChainId || import_read22.
|
|
27606
|
+
const hydartedChain = getChainParams((0, import_read22.getChainConfig)(state.activeChainId || import_read22.LUMIA_MAINNET_CHAIN_ID));
|
|
27599
27607
|
state.activeChainId = hydartedChain.activeChainId;
|
|
27600
27608
|
state.publicClient = hydartedChain.publicClient;
|
|
27601
27609
|
state.bundlerClient = hydartedChain.bundlerClient;
|
|
@@ -30353,7 +30361,7 @@ function Provider(props) {
|
|
|
30353
30361
|
} catch {
|
|
30354
30362
|
}
|
|
30355
30363
|
const activeChainId = useSession.getState().activeChainId;
|
|
30356
|
-
if (!!mergedConfig.network.forceChain && mergedConfig.network.chainId !== activeChainId) {
|
|
30364
|
+
if ((!!mergedConfig.network.autoswitch || !!mergedConfig.network.forceChain) && mergedConfig.network.chainId !== activeChainId) {
|
|
30357
30365
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
30358
30366
|
}
|
|
30359
30367
|
}, [projectId, initialConfig]);
|
package/dist/index.d.cts
CHANGED
|
@@ -288,7 +288,12 @@ interface ProviderConfig {
|
|
|
288
288
|
rpcUrl: string;
|
|
289
289
|
explorerUrl?: string;
|
|
290
290
|
testnet?: boolean;
|
|
291
|
+
/** if true, chain selector is disabled and user cannot switch to other chains */
|
|
291
292
|
forceChain?: boolean;
|
|
293
|
+
/** if true, SDK will ask user to switch to the configured chain on any attempt to change chain.
|
|
294
|
+
* - users can still switch manually,
|
|
295
|
+
* - dApp sets chain to configured on reload */
|
|
296
|
+
autoswitch?: boolean;
|
|
292
297
|
};
|
|
293
298
|
services: {
|
|
294
299
|
assetApiUrl?: string;
|
|
@@ -315,7 +320,13 @@ interface ProviderConfig {
|
|
|
315
320
|
provider?: 'sumsub' | 'uaepass' | 'custom';
|
|
316
321
|
options?: Record<string, any>;
|
|
317
322
|
};
|
|
318
|
-
/**
|
|
323
|
+
/**
|
|
324
|
+
* Affects the language selector component (not actual i18n translations).
|
|
325
|
+
* - For cases if somehow there is no language support in embarkAI, but language required in dApp.
|
|
326
|
+
* Translations object with extra lang map results in language selector option appearing, although if ":passport" namespace is missing embarkAI still falls back to English for all text.
|
|
327
|
+
* - should be same object as registered in i18n.
|
|
328
|
+
* - ```{ [language]: { [project namespace]: {resource map object} } }```
|
|
329
|
+
*/
|
|
319
330
|
translations?: Record<string, Record<string, unknown>>;
|
|
320
331
|
}
|
|
321
332
|
|
package/dist/index.d.ts
CHANGED
|
@@ -288,7 +288,12 @@ interface ProviderConfig {
|
|
|
288
288
|
rpcUrl: string;
|
|
289
289
|
explorerUrl?: string;
|
|
290
290
|
testnet?: boolean;
|
|
291
|
+
/** if true, chain selector is disabled and user cannot switch to other chains */
|
|
291
292
|
forceChain?: boolean;
|
|
293
|
+
/** if true, SDK will ask user to switch to the configured chain on any attempt to change chain.
|
|
294
|
+
* - users can still switch manually,
|
|
295
|
+
* - dApp sets chain to configured on reload */
|
|
296
|
+
autoswitch?: boolean;
|
|
292
297
|
};
|
|
293
298
|
services: {
|
|
294
299
|
assetApiUrl?: string;
|
|
@@ -315,7 +320,13 @@ interface ProviderConfig {
|
|
|
315
320
|
provider?: 'sumsub' | 'uaepass' | 'custom';
|
|
316
321
|
options?: Record<string, any>;
|
|
317
322
|
};
|
|
318
|
-
/**
|
|
323
|
+
/**
|
|
324
|
+
* Affects the language selector component (not actual i18n translations).
|
|
325
|
+
* - For cases if somehow there is no language support in embarkAI, but language required in dApp.
|
|
326
|
+
* Translations object with extra lang map results in language selector option appearing, although if ":passport" namespace is missing embarkAI still falls back to English for all text.
|
|
327
|
+
* - should be same object as registered in i18n.
|
|
328
|
+
* - ```{ [language]: { [project namespace]: {resource map object} } }```
|
|
329
|
+
*/
|
|
319
330
|
translations?: Record<string, Record<string, unknown>>;
|
|
320
331
|
}
|
|
321
332
|
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ __export(initial_exports, {
|
|
|
75
75
|
getIframeUrl: () => getIframeUrl,
|
|
76
76
|
getServiceUrls: () => getServiceUrls
|
|
77
77
|
});
|
|
78
|
-
import {
|
|
78
|
+
import { LUMIA_MAINNET } from "@embarkai/core/read";
|
|
79
79
|
function getServiceUrls() {
|
|
80
80
|
const config = DEFAULT_PROVIDER_CONFIG;
|
|
81
81
|
const globalOverride = typeof window !== "undefined" && window.__EMBARK_SERVICES__ || {};
|
|
@@ -158,13 +158,14 @@ var init_initial = __esm({
|
|
|
158
158
|
authOrder: ["email", "social", "wallet"]
|
|
159
159
|
},
|
|
160
160
|
network: {
|
|
161
|
-
name:
|
|
162
|
-
symbol:
|
|
163
|
-
chainId:
|
|
164
|
-
rpcUrl:
|
|
165
|
-
explorerUrl:
|
|
166
|
-
testnet:
|
|
167
|
-
forceChain: false
|
|
161
|
+
name: LUMIA_MAINNET.name,
|
|
162
|
+
symbol: LUMIA_MAINNET.nativeCurrency.symbol,
|
|
163
|
+
chainId: LUMIA_MAINNET.id,
|
|
164
|
+
rpcUrl: LUMIA_MAINNET.rpcUrls[0],
|
|
165
|
+
explorerUrl: LUMIA_MAINNET.blockExplorerUrl,
|
|
166
|
+
testnet: false,
|
|
167
|
+
forceChain: false,
|
|
168
|
+
autoswitch: false
|
|
168
169
|
},
|
|
169
170
|
services: {
|
|
170
171
|
tssUrl: "",
|
|
@@ -1372,7 +1373,7 @@ function ChainSync() {
|
|
|
1372
1373
|
}, [address, activeChainId]);
|
|
1373
1374
|
useEffect2(() => {
|
|
1374
1375
|
if (!address || !activeChainId) return;
|
|
1375
|
-
const shouldSwitchRequest = !config.current?.network?.forceChain && activeChainId !== config.current?.network?.chainId;
|
|
1376
|
+
const shouldSwitchRequest = !config.current?.network?.forceChain && !!config.current?.network?.autoswitch && activeChainId !== config.current?.network?.chainId;
|
|
1376
1377
|
async function showSwitchChainRequest() {
|
|
1377
1378
|
const stats = await getShareRecoveryStats();
|
|
1378
1379
|
const hasRecoveryData = !!stats && (!!stats.created || stats.devices && stats.devices.length > 0);
|
|
@@ -21595,9 +21596,10 @@ function getAssetBalance(asset) {
|
|
|
21595
21596
|
return Number(formatUnits7(BigInt(asset.balance || "0"), asset.decimals || 18));
|
|
21596
21597
|
}
|
|
21597
21598
|
function isOririnChainEmbarkSupported(originChain) {
|
|
21598
|
-
const
|
|
21599
|
-
|
|
21600
|
-
|
|
21599
|
+
const originChainID = CHAINS_UI_META[originChain]?.chainID;
|
|
21600
|
+
if (!originChainID) return false;
|
|
21601
|
+
const supportedChainIDS = [...SUPPORTED_CHAINS2].map(([chainId]) => chainId);
|
|
21602
|
+
return supportedChainIDS.includes(originChainID) && useSession.getState().activeChainId === originChainID;
|
|
21601
21603
|
}
|
|
21602
21604
|
var init_utils9 = __esm({
|
|
21603
21605
|
"src/internal/components/SendMenu/hyperbridge/utils.ts"() {
|
|
@@ -21889,11 +21891,7 @@ function useHyperlaneRoutes() {
|
|
|
21889
21891
|
retry: false,
|
|
21890
21892
|
enabled: !!address && page === "send" /* SEND */ && flow === "bridge",
|
|
21891
21893
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
21892
|
-
queryFn: async () =>
|
|
21893
|
-
const warpRoutes = await getHyperlaneWarpRoutes();
|
|
21894
|
-
useFlowSelectorStore.getState().setRenderKey(`hyperlane-bridge-warp-routes-loaded-${Date.now()}`);
|
|
21895
|
-
return warpRoutes;
|
|
21896
|
-
}
|
|
21894
|
+
queryFn: async () => await getHyperlaneWarpRoutes()
|
|
21897
21895
|
});
|
|
21898
21896
|
useEffect42(() => {
|
|
21899
21897
|
if (!errorWarpRoutes) return;
|
|
@@ -21906,20 +21904,30 @@ function useHyperlaneRoutes() {
|
|
|
21906
21904
|
}, [errorWarpRoutes]);
|
|
21907
21905
|
useEffect42(() => {
|
|
21908
21906
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
21909
|
-
|
|
21910
|
-
if (!
|
|
21907
|
+
let targetHyperRouteToSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
21908
|
+
if (!targetHyperRouteToSelect) {
|
|
21909
|
+
targetHyperRouteToSelect = hyperlaneWarpRoutes.find(
|
|
21910
|
+
(el) => el.symbol === (useSession.getState().chainConfig?.nativeCurrency?.symbol || "USDT")
|
|
21911
|
+
);
|
|
21912
|
+
}
|
|
21913
|
+
if (!targetHyperRouteToSelect) {
|
|
21914
|
+
useFlowSelectorStore.getState().setRenderKey(`no-hyperlane-bridge-warp-routes-loaded-${Date.now()}`);
|
|
21915
|
+
return;
|
|
21916
|
+
}
|
|
21911
21917
|
let originChainIndex = 0;
|
|
21912
21918
|
let destinationChainIndex = 1;
|
|
21913
|
-
|
|
21914
|
-
|
|
21919
|
+
const { bridgeSender, setOriginChain, setDestinationChain, setHyperRoute } = useBridgeStore.getState();
|
|
21920
|
+
if (bridgeSender === "embarkai-wallet") {
|
|
21921
|
+
const foundIdx = targetHyperRouteToSelect.chainPair?.findIndex((chain) => isOririnChainEmbarkSupported(chain.chainName)) || -1;
|
|
21915
21922
|
if (foundIdx !== -1) {
|
|
21916
21923
|
originChainIndex = foundIdx;
|
|
21917
21924
|
destinationChainIndex = foundIdx === 0 ? 1 : 0;
|
|
21918
21925
|
}
|
|
21919
21926
|
}
|
|
21920
|
-
|
|
21921
|
-
|
|
21922
|
-
|
|
21927
|
+
setOriginChain(targetHyperRouteToSelect.chainPair[originChainIndex].chainName);
|
|
21928
|
+
setDestinationChain(targetHyperRouteToSelect.chainPair[destinationChainIndex].chainName);
|
|
21929
|
+
setHyperRoute(targetHyperRouteToSelect.routeId);
|
|
21930
|
+
useFlowSelectorStore.getState().setRenderKey(`hyperlane-bridge-warp-routes-loaded-${Date.now()}`);
|
|
21923
21931
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
21924
21932
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
21925
21933
|
}
|
|
@@ -22274,7 +22282,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
22274
22282
|
break;
|
|
22275
22283
|
}
|
|
22276
22284
|
}, [bridgeSender, originChain, directWalletChainId, switchChainAsync]);
|
|
22277
|
-
const embarkBalance = CHAINS_UI_META[originChain]
|
|
22285
|
+
const embarkBalance = !!embarkTokenBalanace && CHAINS_UI_META[originChain]?.chainID === activeChainId ? getAssetBalance(embarkTokenBalanace) : 0;
|
|
22278
22286
|
const externalWalletBalance = isSelectedTokenNative ? formatUnits8(externalNativeBalanceData?.value || BigInt(0), externalNativeBalanceData?.decimals || 18) : formatUnits8(externalBalanceData?.value || BigInt(0), externalBalanceData?.decimals || 18);
|
|
22279
22287
|
return {
|
|
22280
22288
|
routeTokenBalance: isEmbarkSender ? embarkBalance : externalWalletBalance,
|
|
@@ -26251,7 +26259,7 @@ var init_package = __esm({
|
|
|
26251
26259
|
"package.json"() {
|
|
26252
26260
|
package_default = {
|
|
26253
26261
|
name: "@embarkai/ui-kit",
|
|
26254
|
-
version: "0.4.
|
|
26262
|
+
version: "0.4.78",
|
|
26255
26263
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
26256
26264
|
type: "module",
|
|
26257
26265
|
main: "./dist/index.cjs",
|
|
@@ -27392,9 +27400,9 @@ var init_WalletConnectHandler = __esm({
|
|
|
27392
27400
|
import {
|
|
27393
27401
|
createBundlerClientForChain,
|
|
27394
27402
|
createPublicClientForChain as createPublicClientForChain6,
|
|
27395
|
-
DEFAULT_CHAIN_ID as DEFAULT_CHAIN_ID2,
|
|
27396
27403
|
getChainConfig as getChainConfig12,
|
|
27397
|
-
getViemChain as getViemChain2
|
|
27404
|
+
getViemChain as getViemChain2,
|
|
27405
|
+
LUMIA_MAINNET_CHAIN_ID as LUMIA_MAINNET_CHAIN_ID5
|
|
27398
27406
|
} from "@embarkai/core/read";
|
|
27399
27407
|
import { Fragment as Fragment44 } from "react";
|
|
27400
27408
|
import { create as create16 } from "zustand";
|
|
@@ -27504,7 +27512,7 @@ var init_SessionContext = __esm({
|
|
|
27504
27512
|
// Set default chainId after hydration if not persisted
|
|
27505
27513
|
onRehydrateStorage: () => (state) => {
|
|
27506
27514
|
if (!state) return;
|
|
27507
|
-
const hydartedChain = getChainParams(getChainConfig12(state.activeChainId ||
|
|
27515
|
+
const hydartedChain = getChainParams(getChainConfig12(state.activeChainId || LUMIA_MAINNET_CHAIN_ID5));
|
|
27508
27516
|
state.activeChainId = hydartedChain.activeChainId;
|
|
27509
27517
|
state.publicClient = hydartedChain.publicClient;
|
|
27510
27518
|
state.bundlerClient = hydartedChain.bundlerClient;
|
|
@@ -30293,7 +30301,7 @@ function Provider(props) {
|
|
|
30293
30301
|
} catch {
|
|
30294
30302
|
}
|
|
30295
30303
|
const activeChainId = useSession.getState().activeChainId;
|
|
30296
|
-
if (!!mergedConfig.network.forceChain && mergedConfig.network.chainId !== activeChainId) {
|
|
30304
|
+
if ((!!mergedConfig.network.autoswitch || !!mergedConfig.network.forceChain) && mergedConfig.network.chainId !== activeChainId) {
|
|
30297
30305
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
30298
30306
|
}
|
|
30299
30307
|
}, [projectId, initialConfig]);
|