@embarkai/ui-kit 0.4.77 → 0.4.79

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.
@@ -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.77</title>
18
+ <title>EmbarkAI Secure Wallet - iframe version 0.4.79</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>
@@ -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.77";
6417
+ var IFRAME_VERSION = "0.4.79";
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.BSC_TESTNET.name,
172
- symbol: import_read.BSC_TESTNET.nativeCurrency.symbol,
173
- chainId: import_read.BSC_TESTNET.id,
174
- rpcUrl: import_read.BSC_TESTNET.rpcUrls[0],
175
- explorerUrl: import_read.BSC_TESTNET.blockExplorerUrl,
176
- testnet: true,
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 activeChainId = useSession.getState().activeChainId;
21681
- const supportedChain = [...import_read20.SUPPORTED_CHAINS].map(([chainId]) => chainId);
21682
- return supportedChain.includes(CHAINS_UI_META[originChain].chainID) && activeChainId === CHAINS_UI_META[originChain].chainID;
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
- const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
21994
- if (!warpRouteToAutoSelect) return;
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
- if (useBridgeStore.getState().bridgeSender === "embarkai-wallet") {
21998
- const foundIdx = warpRouteToAutoSelect.chainPair?.findIndex((chain) => isOririnChainEmbarkSupported(chain.chainName)) || -1;
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
- useBridgeStore.getState().setOriginChain(warpRouteToAutoSelect.chainPair[originChainIndex].chainName);
22005
- useBridgeStore.getState().setDestinationChain(warpRouteToAutoSelect.chainPair[destinationChainIndex].chainName);
22006
- useBridgeStore.getState().setHyperRoute(warpRouteToAutoSelect?.routeId || hyperlaneWarpRoutes[0].routeId);
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
  }
@@ -22160,14 +22168,7 @@ var init_onboarding_setup9 = __esm({
22160
22168
  elId: "sendmenu-page" /* sendMenu */,
22161
22169
  title: "passport:bridgeMenu.onboarding.bridgeMenu.title",
22162
22170
  description: "passport:bridgeMenu.onboarding.bridgeMenu.description",
22163
- waitSecs: 5,
22164
- onNext: () => {
22165
- const { setHyperRoute, setBridgeAssetSymbol, setOriginChain, setDestinationChain } = useBridgeStore.getState();
22166
- setHyperRoute("USDT/ethereum-lumiaprism");
22167
- setBridgeAssetSymbol("USDT");
22168
- setOriginChain("lumiaprism");
22169
- setDestinationChain("ethereum");
22170
- }
22171
+ waitSecs: 5
22171
22172
  },
22172
22173
  {
22173
22174
  elId: "bridgemenu-sender-wallet-selector" /* bridgeSenderWalletSelector */,
@@ -22357,7 +22358,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
22357
22358
  break;
22358
22359
  }
22359
22360
  }, [bridgeSender, originChain, directWalletChainId, switchChainAsync]);
22360
- const embarkBalance = CHAINS_UI_META[originChain].chainID === activeChainId && embarkTokenBalanace ? getAssetBalance(embarkTokenBalanace) : 0;
22361
+ const embarkBalance = !!embarkTokenBalanace && CHAINS_UI_META[originChain]?.chainID === activeChainId ? getAssetBalance(embarkTokenBalanace) : 0;
22361
22362
  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
22363
  return {
22363
22364
  routeTokenBalance: isEmbarkSender ? embarkBalance : externalWalletBalance,
@@ -24698,32 +24699,44 @@ function useSendMenuParams() {
24698
24699
  (0, import_react85.useEffect)(() => {
24699
24700
  const { pageParams, setPageParams } = useLayoutDataStore.getState();
24700
24701
  if (!pageParams || !(0, import_lodash_es13.keys)(pageParams).length) return;
24701
- console.log("[SEND PARAMS]", pageParams);
24702
- const { sendFlow, asset, to, amount } = pageParams || {};
24702
+ const { sendFlow, send, bridge } = pageParams || {};
24703
24703
  const {
24704
24704
  setAmount: setSendAmount,
24705
24705
  setRecipient: setSendRecipient,
24706
24706
  setSelectedAsset: setSendSelectedAsset
24707
24707
  } = useSendStore.getState();
24708
- const { setAmount: setBridgeAmount } = useBridgeStore.getState();
24708
+ const {
24709
+ setAmount: setBridgeAmount,
24710
+ setHyperRoute: setBridgeHyperRoute,
24711
+ setOriginChain: setBridgeOriginChain,
24712
+ setDestinationChain: setBridgeDestinationChain,
24713
+ setRecipient: setBridgeRecipient
24714
+ } = useBridgeStore.getState();
24709
24715
  useFlowSelectorStore.getState().setFlow(sendFlow);
24710
24716
  switch (sendFlow) {
24711
24717
  //
24712
24718
  case "send":
24713
24719
  switch (true) {
24714
- case !!asset:
24715
- setSendAmount(String(amount));
24716
- case !!to:
24717
- setSendRecipient(to);
24718
- case !!amount:
24719
- setSendSelectedAsset(asset);
24720
+ case !!send.asset:
24721
+ setSendSelectedAsset(send.asset);
24722
+ case !!send.recipient:
24723
+ setSendRecipient(send.recipient);
24724
+ case !!send.amount:
24725
+ setSendAmount(String(send.amount));
24720
24726
  }
24721
24727
  break;
24722
24728
  //
24723
24729
  case "bridge":
24724
24730
  switch (true) {
24725
- case !!amount:
24726
- setBridgeAmount(String(amount));
24731
+ // shpuld be set together
24732
+ case (!!bridge.route && !!bridge.originChain && !!bridge.destinationChain):
24733
+ setBridgeHyperRoute(bridge.route);
24734
+ setBridgeOriginChain(bridge.originChain);
24735
+ setBridgeDestinationChain(bridge.destinationChain);
24736
+ case !!bridge.recipient:
24737
+ setBridgeRecipient(bridge.recipient);
24738
+ case !!bridge.amount:
24739
+ setTimeout(() => setBridgeAmount(bridge.amount), 100);
24727
24740
  }
24728
24741
  break;
24729
24742
  default:
@@ -26345,7 +26358,7 @@ var init_package = __esm({
26345
26358
  "package.json"() {
26346
26359
  package_default = {
26347
26360
  name: "@embarkai/ui-kit",
26348
- version: "0.4.77",
26361
+ version: "0.4.79",
26349
26362
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
26350
26363
  type: "module",
26351
26364
  main: "./dist/index.cjs",
@@ -27595,7 +27608,7 @@ var init_SessionContext = __esm({
27595
27608
  // Set default chainId after hydration if not persisted
27596
27609
  onRehydrateStorage: () => (state) => {
27597
27610
  if (!state) return;
27598
- const hydartedChain = getChainParams((0, import_read22.getChainConfig)(state.activeChainId || import_read22.DEFAULT_CHAIN_ID));
27611
+ const hydartedChain = getChainParams((0, import_read22.getChainConfig)(state.activeChainId || import_read22.LUMIA_MAINNET_CHAIN_ID));
27599
27612
  state.activeChainId = hydartedChain.activeChainId;
27600
27613
  state.publicClient = hydartedChain.publicClient;
27601
27614
  state.bundlerClient = hydartedChain.bundlerClient;
@@ -30353,7 +30366,7 @@ function Provider(props) {
30353
30366
  } catch {
30354
30367
  }
30355
30368
  const activeChainId = useSession.getState().activeChainId;
30356
- if (!!mergedConfig.network.forceChain && mergedConfig.network.chainId !== activeChainId) {
30369
+ if ((!!mergedConfig.network.autoswitch || !!mergedConfig.network.forceChain) && mergedConfig.network.chainId !== activeChainId) {
30357
30370
  useSession.getState().setActiveChainId(mergedConfig.network.chainId);
30358
30371
  }
30359
30372
  }, [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
- /** language -> project namespace -> resource map */
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
- /** language -> project namespace -> resource map */
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 { BSC_TESTNET } from "@embarkai/core/read";
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: BSC_TESTNET.name,
162
- symbol: BSC_TESTNET.nativeCurrency.symbol,
163
- chainId: BSC_TESTNET.id,
164
- rpcUrl: BSC_TESTNET.rpcUrls[0],
165
- explorerUrl: BSC_TESTNET.blockExplorerUrl,
166
- testnet: true,
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 activeChainId = useSession.getState().activeChainId;
21599
- const supportedChain = [...SUPPORTED_CHAINS2].map(([chainId]) => chainId);
21600
- return supportedChain.includes(CHAINS_UI_META[originChain].chainID) && activeChainId === CHAINS_UI_META[originChain].chainID;
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
- const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
21910
- if (!warpRouteToAutoSelect) return;
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
- if (useBridgeStore.getState().bridgeSender === "embarkai-wallet") {
21914
- const foundIdx = warpRouteToAutoSelect.chainPair?.findIndex((chain) => isOririnChainEmbarkSupported(chain.chainName)) || -1;
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
- useBridgeStore.getState().setOriginChain(warpRouteToAutoSelect.chainPair[originChainIndex].chainName);
21921
- useBridgeStore.getState().setDestinationChain(warpRouteToAutoSelect.chainPair[destinationChainIndex].chainName);
21922
- useBridgeStore.getState().setHyperRoute(warpRouteToAutoSelect?.routeId || hyperlaneWarpRoutes[0].routeId);
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
  }
@@ -22073,14 +22081,7 @@ var init_onboarding_setup9 = __esm({
22073
22081
  elId: "sendmenu-page" /* sendMenu */,
22074
22082
  title: "passport:bridgeMenu.onboarding.bridgeMenu.title",
22075
22083
  description: "passport:bridgeMenu.onboarding.bridgeMenu.description",
22076
- waitSecs: 5,
22077
- onNext: () => {
22078
- const { setHyperRoute, setBridgeAssetSymbol, setOriginChain, setDestinationChain } = useBridgeStore.getState();
22079
- setHyperRoute("USDT/ethereum-lumiaprism");
22080
- setBridgeAssetSymbol("USDT");
22081
- setOriginChain("lumiaprism");
22082
- setDestinationChain("ethereum");
22083
- }
22084
+ waitSecs: 5
22084
22085
  },
22085
22086
  {
22086
22087
  elId: "bridgemenu-sender-wallet-selector" /* bridgeSenderWalletSelector */,
@@ -22274,7 +22275,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
22274
22275
  break;
22275
22276
  }
22276
22277
  }, [bridgeSender, originChain, directWalletChainId, switchChainAsync]);
22277
- const embarkBalance = CHAINS_UI_META[originChain].chainID === activeChainId && embarkTokenBalanace ? getAssetBalance(embarkTokenBalanace) : 0;
22278
+ const embarkBalance = !!embarkTokenBalanace && CHAINS_UI_META[originChain]?.chainID === activeChainId ? getAssetBalance(embarkTokenBalanace) : 0;
22278
22279
  const externalWalletBalance = isSelectedTokenNative ? formatUnits8(externalNativeBalanceData?.value || BigInt(0), externalNativeBalanceData?.decimals || 18) : formatUnits8(externalBalanceData?.value || BigInt(0), externalBalanceData?.decimals || 18);
22279
22280
  return {
22280
22281
  routeTokenBalance: isEmbarkSender ? embarkBalance : externalWalletBalance,
@@ -24604,32 +24605,44 @@ function useSendMenuParams() {
24604
24605
  useEffect49(() => {
24605
24606
  const { pageParams, setPageParams } = useLayoutDataStore.getState();
24606
24607
  if (!pageParams || !keys2(pageParams).length) return;
24607
- console.log("[SEND PARAMS]", pageParams);
24608
- const { sendFlow, asset, to, amount } = pageParams || {};
24608
+ const { sendFlow, send, bridge } = pageParams || {};
24609
24609
  const {
24610
24610
  setAmount: setSendAmount,
24611
24611
  setRecipient: setSendRecipient,
24612
24612
  setSelectedAsset: setSendSelectedAsset
24613
24613
  } = useSendStore.getState();
24614
- const { setAmount: setBridgeAmount } = useBridgeStore.getState();
24614
+ const {
24615
+ setAmount: setBridgeAmount,
24616
+ setHyperRoute: setBridgeHyperRoute,
24617
+ setOriginChain: setBridgeOriginChain,
24618
+ setDestinationChain: setBridgeDestinationChain,
24619
+ setRecipient: setBridgeRecipient
24620
+ } = useBridgeStore.getState();
24615
24621
  useFlowSelectorStore.getState().setFlow(sendFlow);
24616
24622
  switch (sendFlow) {
24617
24623
  //
24618
24624
  case "send":
24619
24625
  switch (true) {
24620
- case !!asset:
24621
- setSendAmount(String(amount));
24622
- case !!to:
24623
- setSendRecipient(to);
24624
- case !!amount:
24625
- setSendSelectedAsset(asset);
24626
+ case !!send.asset:
24627
+ setSendSelectedAsset(send.asset);
24628
+ case !!send.recipient:
24629
+ setSendRecipient(send.recipient);
24630
+ case !!send.amount:
24631
+ setSendAmount(String(send.amount));
24626
24632
  }
24627
24633
  break;
24628
24634
  //
24629
24635
  case "bridge":
24630
24636
  switch (true) {
24631
- case !!amount:
24632
- setBridgeAmount(String(amount));
24637
+ // shpuld be set together
24638
+ case (!!bridge.route && !!bridge.originChain && !!bridge.destinationChain):
24639
+ setBridgeHyperRoute(bridge.route);
24640
+ setBridgeOriginChain(bridge.originChain);
24641
+ setBridgeDestinationChain(bridge.destinationChain);
24642
+ case !!bridge.recipient:
24643
+ setBridgeRecipient(bridge.recipient);
24644
+ case !!bridge.amount:
24645
+ setTimeout(() => setBridgeAmount(bridge.amount), 100);
24633
24646
  }
24634
24647
  break;
24635
24648
  default:
@@ -26251,7 +26264,7 @@ var init_package = __esm({
26251
26264
  "package.json"() {
26252
26265
  package_default = {
26253
26266
  name: "@embarkai/ui-kit",
26254
- version: "0.4.77",
26267
+ version: "0.4.79",
26255
26268
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
26256
26269
  type: "module",
26257
26270
  main: "./dist/index.cjs",
@@ -27392,9 +27405,9 @@ var init_WalletConnectHandler = __esm({
27392
27405
  import {
27393
27406
  createBundlerClientForChain,
27394
27407
  createPublicClientForChain as createPublicClientForChain6,
27395
- DEFAULT_CHAIN_ID as DEFAULT_CHAIN_ID2,
27396
27408
  getChainConfig as getChainConfig12,
27397
- getViemChain as getViemChain2
27409
+ getViemChain as getViemChain2,
27410
+ LUMIA_MAINNET_CHAIN_ID as LUMIA_MAINNET_CHAIN_ID5
27398
27411
  } from "@embarkai/core/read";
27399
27412
  import { Fragment as Fragment44 } from "react";
27400
27413
  import { create as create16 } from "zustand";
@@ -27504,7 +27517,7 @@ var init_SessionContext = __esm({
27504
27517
  // Set default chainId after hydration if not persisted
27505
27518
  onRehydrateStorage: () => (state) => {
27506
27519
  if (!state) return;
27507
- const hydartedChain = getChainParams(getChainConfig12(state.activeChainId || DEFAULT_CHAIN_ID2));
27520
+ const hydartedChain = getChainParams(getChainConfig12(state.activeChainId || LUMIA_MAINNET_CHAIN_ID5));
27508
27521
  state.activeChainId = hydartedChain.activeChainId;
27509
27522
  state.publicClient = hydartedChain.publicClient;
27510
27523
  state.bundlerClient = hydartedChain.bundlerClient;
@@ -30293,7 +30306,7 @@ function Provider(props) {
30293
30306
  } catch {
30294
30307
  }
30295
30308
  const activeChainId = useSession.getState().activeChainId;
30296
- if (!!mergedConfig.network.forceChain && mergedConfig.network.chainId !== activeChainId) {
30309
+ if ((!!mergedConfig.network.autoswitch || !!mergedConfig.network.forceChain) && mergedConfig.network.chainId !== activeChainId) {
30297
30310
  useSession.getState().setActiveChainId(mergedConfig.network.chainId);
30298
30311
  }
30299
30312
  }, [projectId, initialConfig]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embarkai/ui-kit",
3
- "version": "0.4.77",
3
+ "version": "0.4.79",
4
4
  "description": "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",