@embarkai/ui-kit 0.4.52 → 0.4.53

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.52</title>
18
+ <title>EmbarkAI Secure Wallet - iframe version 0.4.53</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>
@@ -6391,7 +6391,7 @@ var SigningManager = class extends TokenRefreshApiClient {
6391
6391
  };
6392
6392
 
6393
6393
  // src/iframe/main.ts
6394
- var IFRAME_VERSION = "0.4.52";
6394
+ var IFRAME_VERSION = "0.4.53";
6395
6395
  var IframeWallet = class {
6396
6396
  constructor() {
6397
6397
  console.log("=".repeat(60));
package/dist/index.cjs CHANGED
@@ -17903,6 +17903,9 @@ function isSecurityToken(asset) {
17903
17903
  if (!("type" in asset)) return false;
17904
17904
  return asset.type === "erc3643";
17905
17905
  }
17906
+ function isProjectAssetConfig(asset) {
17907
+ return "balanceQueryKey" in asset && "balanceQuery" in asset;
17908
+ }
17906
17909
  function isAssetRateAvailable(symbol) {
17907
17910
  switch (symbol) {
17908
17911
  // list of prohibited symbols without market data on Binance
@@ -17986,11 +17989,17 @@ function PortfolioItemImage(props) {
17986
17989
  function PortfolioItem(props) {
17987
17990
  const { address, asset, isProjectAsset } = props;
17988
17991
  const providerConfig = useProviderConfig().config.current;
17989
- const { assets: projectAssets, showBalanceAs: showBalanceAsSymbol } = providerConfig.projectAssets || {};
17990
17992
  const customAssetRateQuery = providerConfig.portfolio?.assetRateQuery;
17991
- const qc = (0, import_react_query38.useQueryClient)();
17992
- const { balanceQueryKey } = projectAssets?.find((a) => a.symbol === showBalanceAsSymbol) || {};
17993
- const projectAssetBalance = !!balanceQueryKey ? qc.getQueryData(balanceQueryKey) : null;
17993
+ const projectAssetQuery = isProjectAsset && isProjectAssetConfig(asset) ? {
17994
+ queryKey: asset.balanceQueryKey,
17995
+ queryFn: asset.balanceQuery
17996
+ } : void 0;
17997
+ const { data: projectAssetBalance } = (0, import_react_query38.useQuery)({
17998
+ enabled: !!projectAssetQuery,
17999
+ retry: false,
18000
+ queryKey: projectAssetQuery?.queryKey ?? ["project-asset-balance-disabled", asset.symbol],
18001
+ queryFn: async () => projectAssetQuery?.queryFn() ?? null
18002
+ });
17994
18003
  const isNft = isNftAsset(asset);
17995
18004
  const isSecurity = isSecurityToken(asset);
17996
18005
  const embeddedRate = Number(asset.exchangeRateUsd || 0);
@@ -18003,8 +18012,8 @@ function PortfolioItem(props) {
18003
18012
  // customAssetRateQueryKey
18004
18013
  queryFn: async () => await resolveAssetRate(asset.symbol, asset.address, customAssetRateQuery)
18005
18014
  });
18006
- const showProjectFiatBalance = isProjectAsset && !!projectAssetBalance?.fiatFormatted;
18007
- const renderBalance = showProjectFiatBalance ? projectAssetBalance?.fiatFormatted || 0 : Number((0, import_viem9.formatUnits)(BigInt(asset?.balance || "0"), asset?.decimals || 18));
18015
+ const hasProjectAssetBalance = isProjectAsset && projectAssetBalance != null;
18016
+ const renderBalance = hasProjectAssetBalance ? projectAssetBalance.cryptoFormatted : Number((0, import_viem9.formatUnits)(BigInt(asset?.balance || "0"), asset?.decimals || 18));
18008
18017
  const resolvedRate = hasEmbeddedRate ? embeddedRate : Number(assetRate?.price || 0);
18009
18018
  const usdRenderBalance = resolvedRate > 0 ? renderBalance * resolvedRate : 0;
18010
18019
  const shortContractAddress = asset.address ? truncateMiddle(asset.address, 6, 4) : null;
@@ -24150,7 +24159,7 @@ var init_package = __esm({
24150
24159
  "package.json"() {
24151
24160
  package_default = {
24152
24161
  name: "@embarkai/ui-kit",
24153
- version: "0.4.52",
24162
+ version: "0.4.53",
24154
24163
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
24155
24164
  type: "module",
24156
24165
  main: "./dist/index.cjs",
package/dist/index.d.cts CHANGED
@@ -169,16 +169,17 @@ interface SocialProvider {
169
169
  comingSoon?: boolean;
170
170
  meta?: Record<string, any>;
171
171
  }
172
+ interface ProjectAssetBalance {
173
+ cryptoFormatted: number;
174
+ cryptoFiatRate: number;
175
+ cryptoSymbol: string;
176
+ fiatFormatted: number;
177
+ fiatSymbol: string;
178
+ }
172
179
  interface ProjectAsset extends Omit<Asset, 'type'> {
173
180
  type: 'project';
174
181
  balanceQueryKey: string[];
175
- balanceQuery: () => Promise<{
176
- cryptoFormatted: number;
177
- cryptoFiatRate: number;
178
- cryptoSymbol: string;
179
- fiatFormatted: number;
180
- fiatSymbol: string;
181
- }>;
182
+ balanceQuery: () => Promise<ProjectAssetBalance>;
182
183
  hideInPortfolio?: boolean;
183
184
  }
184
185
  interface AssetRateQueryInput {
package/dist/index.d.ts CHANGED
@@ -169,16 +169,17 @@ interface SocialProvider {
169
169
  comingSoon?: boolean;
170
170
  meta?: Record<string, any>;
171
171
  }
172
+ interface ProjectAssetBalance {
173
+ cryptoFormatted: number;
174
+ cryptoFiatRate: number;
175
+ cryptoSymbol: string;
176
+ fiatFormatted: number;
177
+ fiatSymbol: string;
178
+ }
172
179
  interface ProjectAsset extends Omit<Asset, 'type'> {
173
180
  type: 'project';
174
181
  balanceQueryKey: string[];
175
- balanceQuery: () => Promise<{
176
- cryptoFormatted: number;
177
- cryptoFiatRate: number;
178
- cryptoSymbol: string;
179
- fiatFormatted: number;
180
- fiatSymbol: string;
181
- }>;
182
+ balanceQuery: () => Promise<ProjectAssetBalance>;
182
183
  hideInPortfolio?: boolean;
183
184
  }
184
185
  interface AssetRateQueryInput {
package/dist/index.js CHANGED
@@ -17826,7 +17826,7 @@ var init_BalanceView2 = __esm({
17826
17826
  });
17827
17827
 
17828
17828
  // src/internal/components/PortfolioMenu/PortfolioItem.tsx
17829
- import { useQuery as useQuery16, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
17829
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
17830
17830
  import { LoaderIcon as LoaderIcon7, ShieldAlertIcon, SparklesIcon } from "lucide-react";
17831
17831
  import { formatUnits as formatUnits5 } from "viem";
17832
17832
  import { Fragment as Fragment30, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
@@ -17845,6 +17845,9 @@ function isSecurityToken(asset) {
17845
17845
  if (!("type" in asset)) return false;
17846
17846
  return asset.type === "erc3643";
17847
17847
  }
17848
+ function isProjectAssetConfig(asset) {
17849
+ return "balanceQueryKey" in asset && "balanceQuery" in asset;
17850
+ }
17848
17851
  function isAssetRateAvailable(symbol) {
17849
17852
  switch (symbol) {
17850
17853
  // list of prohibited symbols without market data on Binance
@@ -17928,11 +17931,17 @@ function PortfolioItemImage(props) {
17928
17931
  function PortfolioItem(props) {
17929
17932
  const { address, asset, isProjectAsset } = props;
17930
17933
  const providerConfig = useProviderConfig().config.current;
17931
- const { assets: projectAssets, showBalanceAs: showBalanceAsSymbol } = providerConfig.projectAssets || {};
17932
17934
  const customAssetRateQuery = providerConfig.portfolio?.assetRateQuery;
17933
- const qc = useQueryClient19();
17934
- const { balanceQueryKey } = projectAssets?.find((a) => a.symbol === showBalanceAsSymbol) || {};
17935
- const projectAssetBalance = !!balanceQueryKey ? qc.getQueryData(balanceQueryKey) : null;
17935
+ const projectAssetQuery = isProjectAsset && isProjectAssetConfig(asset) ? {
17936
+ queryKey: asset.balanceQueryKey,
17937
+ queryFn: asset.balanceQuery
17938
+ } : void 0;
17939
+ const { data: projectAssetBalance } = useQuery16({
17940
+ enabled: !!projectAssetQuery,
17941
+ retry: false,
17942
+ queryKey: projectAssetQuery?.queryKey ?? ["project-asset-balance-disabled", asset.symbol],
17943
+ queryFn: async () => projectAssetQuery?.queryFn() ?? null
17944
+ });
17936
17945
  const isNft = isNftAsset(asset);
17937
17946
  const isSecurity = isSecurityToken(asset);
17938
17947
  const embeddedRate = Number(asset.exchangeRateUsd || 0);
@@ -17945,8 +17954,8 @@ function PortfolioItem(props) {
17945
17954
  // customAssetRateQueryKey
17946
17955
  queryFn: async () => await resolveAssetRate(asset.symbol, asset.address, customAssetRateQuery)
17947
17956
  });
17948
- const showProjectFiatBalance = isProjectAsset && !!projectAssetBalance?.fiatFormatted;
17949
- const renderBalance = showProjectFiatBalance ? projectAssetBalance?.fiatFormatted || 0 : Number(formatUnits5(BigInt(asset?.balance || "0"), asset?.decimals || 18));
17957
+ const hasProjectAssetBalance = isProjectAsset && projectAssetBalance != null;
17958
+ const renderBalance = hasProjectAssetBalance ? projectAssetBalance.cryptoFormatted : Number(formatUnits5(BigInt(asset?.balance || "0"), asset?.decimals || 18));
17950
17959
  const resolvedRate = hasEmbeddedRate ? embeddedRate : Number(assetRate?.price || 0);
17951
17960
  const usdRenderBalance = resolvedRate > 0 ? renderBalance * resolvedRate : 0;
17952
17961
  const shortContractAddress = asset.address ? truncateMiddle(asset.address, 6, 4) : null;
@@ -18027,14 +18036,14 @@ var init_PortfolioItem = __esm({
18027
18036
  });
18028
18037
 
18029
18038
  // src/internal/components/PortfolioMenu/PortfolioMenu.tsx
18030
- import { useQueryClient as useQueryClient20 } from "@tanstack/react-query";
18039
+ import { useQueryClient as useQueryClient19 } from "@tanstack/react-query";
18031
18040
  import { AlertCircle as AlertCircle4, ArrowLeft as ArrowLeft16, Gem, Loader as Loader19, RefreshCw as RefreshCw2 } from "lucide-react";
18032
18041
  import { useCallback as useCallback23 } from "react";
18033
18042
  import { jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
18034
18043
  function PortfolioMenu() {
18035
18044
  const { assets: projectAssets = [] } = useProviderConfig().config.current?.projectAssets || {};
18036
18045
  const { t } = useT();
18037
- const qc = useQueryClient20();
18046
+ const qc = useQueryClient19();
18038
18047
  const address = useSession((st) => st.address);
18039
18048
  const setPage = useLayoutDataStore((st) => st.setPage);
18040
18049
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
@@ -18749,12 +18758,12 @@ var init_UntrustApplication = __esm({
18749
18758
  });
18750
18759
 
18751
18760
  // src/internal/components/SecurityMenu/SecurityMenu.tsx
18752
- import { useMutation as useMutation17, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
18761
+ import { useMutation as useMutation17, useQueryClient as useQueryClient20 } from "@tanstack/react-query";
18753
18762
  import { ArrowLeft as ArrowLeft18 } from "lucide-react";
18754
18763
  import { useState as useState24 } from "react";
18755
18764
  import { jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
18756
18765
  function SecurityMenu() {
18757
- const qc = useQueryClient21();
18766
+ const qc = useQueryClient20();
18758
18767
  const { t } = useT();
18759
18768
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
18760
18769
  const setPage = useLayoutDataStore((st) => st.setPage);
@@ -19769,11 +19778,11 @@ var init_useOperationHashesStore = __esm({
19769
19778
  });
19770
19779
 
19771
19780
  // src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
19772
- import { useMutation as useMutation19, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
19781
+ import { useMutation as useMutation19, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
19773
19782
  import { useCallback as useCallback26 } from "react";
19774
19783
  import { useSwitchChain, useWalletClient } from "wagmi";
19775
19784
  function useBridge() {
19776
- const qc = useQueryClient22();
19785
+ const qc = useQueryClient21();
19777
19786
  const { t } = useT();
19778
19787
  const address = useSession((st) => st.address);
19779
19788
  const { data: walletClient } = useWalletClient();
@@ -20093,7 +20102,7 @@ var init_ResolveChainIcon = __esm({
20093
20102
 
20094
20103
  // src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
20095
20104
  import { CHAINS_BROWSERS_TRANSPORTS as CHAINS_BROWSERS_TRANSPORTS2 } from "@embarkai/core";
20096
- import { useQuery as useQuery20, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
20105
+ import { useQuery as useQuery20, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
20097
20106
  import { useCallback as useCallback27, useEffect as useEffect37 } from "react";
20098
20107
  import { createPublicClient as createPublicClient2, erc20Abi as erc20Abi2, formatUnits as formatUnits7, http as http3 } from "viem";
20099
20108
  import { useSwitchChain as useSwitchChain2 } from "wagmi";
@@ -20104,7 +20113,7 @@ function checkWrapedTokenSymbol2(symbol) {
20104
20113
  return symbol.toUpperCase();
20105
20114
  }
20106
20115
  function useBridgeBalance(hyperlaneWarpRoutes) {
20107
- const qc = useQueryClient23();
20116
+ const qc = useQueryClient22();
20108
20117
  const { t } = useT();
20109
20118
  const address = useSession((st) => st.address);
20110
20119
  const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
@@ -20765,7 +20774,7 @@ var init_SuccessStep = __esm({
20765
20774
  });
20766
20775
 
20767
20776
  // src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx
20768
- import { useQueryClient as useQueryClient24 } from "@tanstack/react-query";
20777
+ import { useQueryClient as useQueryClient23 } from "@tanstack/react-query";
20769
20778
  import dayjs7 from "dayjs";
20770
20779
  import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as InfoIcon4, LoaderIcon as LoaderIcon11 } from "lucide-react";
20771
20780
  import { jsx as jsx100, jsxs as jsxs92 } from "react/jsx-runtime";
@@ -20886,7 +20895,7 @@ function HistoryItem(props) {
20886
20895
  txStatus
20887
20896
  } = props;
20888
20897
  const { t } = useT();
20889
- const qc = useQueryClient24();
20898
+ const qc = useQueryClient23();
20890
20899
  const address = useSession((st) => st.address);
20891
20900
  const warpRoutes = qc.getQueryData([HYPERLANE_WARP_ROUTES_QUERY_KEY, address]);
20892
20901
  const assetWarpRoute = warpRoutes?.find((route) => {
@@ -23689,12 +23698,12 @@ var init_TransactionsGroup = __esm({
23689
23698
  });
23690
23699
 
23691
23700
  // src/internal/components/TransactionsMenu/TransactionsMenu.tsx
23692
- import { useQuery as useQuery23, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
23701
+ import { useQuery as useQuery23, useQueryClient as useQueryClient24 } from "@tanstack/react-query";
23693
23702
  import { ArrowLeft as ArrowLeft22, Loader as Loader31, RefreshCw as RefreshCw3, XCircle } from "lucide-react";
23694
23703
  import { useCallback as useCallback29, useState as useState31 } from "react";
23695
23704
  import { jsx as jsx115, jsxs as jsxs106 } from "react/jsx-runtime";
23696
23705
  function TransactionsMenu() {
23697
- const qc = useQueryClient25();
23706
+ const qc = useQueryClient24();
23698
23707
  const address = useSession((st) => st.address);
23699
23708
  const chainConfig = useSession((st) => st.chainConfig);
23700
23709
  const { t } = useT();
@@ -24061,7 +24070,7 @@ var init_package = __esm({
24061
24070
  "package.json"() {
24062
24071
  package_default = {
24063
24072
  name: "@embarkai/ui-kit",
24064
- version: "0.4.52",
24073
+ version: "0.4.53",
24065
24074
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
24066
24075
  type: "module",
24067
24076
  main: "./dist/index.cjs",
@@ -24162,12 +24171,12 @@ var init_package = __esm({
24162
24171
  });
24163
24172
 
24164
24173
  // src/internal/components/Footer/Footer.tsx
24165
- import { useMutation as useMutation21, useQueryClient as useQueryClient26 } from "@tanstack/react-query";
24174
+ import { useMutation as useMutation21, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
24166
24175
  import { Loader as Loader32, LogOut } from "lucide-react";
24167
24176
  import { useDisconnect as useDisconnect3 } from "wagmi";
24168
24177
  import { jsx as jsx117, jsxs as jsxs107 } from "react/jsx-runtime";
24169
24178
  function Footer() {
24170
- const qc = useQueryClient26();
24179
+ const qc = useQueryClient25();
24171
24180
  const { callbacksRef } = useProviderConfig();
24172
24181
  const { t } = useT();
24173
24182
  const address = useSession((st) => st.address);
@@ -24749,11 +24758,11 @@ var init_TssManager = __esm({
24749
24758
 
24750
24759
  // src/internal/components/WalletConnectHandler.tsx
24751
24760
  import { useConnectModal as useConnectModal2 } from "@rainbow-me/rainbowkit";
24752
- import { useMutation as useMutation22, useQueryClient as useQueryClient27 } from "@tanstack/react-query";
24761
+ import { useMutation as useMutation22, useQueryClient as useQueryClient26 } from "@tanstack/react-query";
24753
24762
  import React27, { useCallback as useCallback33, useEffect as useEffect47 } from "react";
24754
24763
  import { useAccount, useDisconnect as useDisconnect4, useSignMessage as useSignMessage2 } from "wagmi";
24755
24764
  function WalletConnectHandler() {
24756
- const qc = useQueryClient27();
24765
+ const qc = useQueryClient26();
24757
24766
  const { callbacksRef } = useProviderConfig();
24758
24767
  const passportWalletAddress = useSession((st) => st.address);
24759
24768
  const { address: walletAddress, isConnected, chain, connector } = useAccount();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embarkai/ui-kit",
3
- "version": "0.4.52",
3
+ "version": "0.4.53",
4
4
  "description": "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",