@wheelx-widget/widget 0.1.14 → 0.1.16

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/index.js CHANGED
@@ -50371,7 +50371,7 @@ var MobileContent = React5.memo(function MobileContent2({
50371
50371
  isMobileChainsOpen
50372
50372
  ]);
50373
50373
  return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { w: "100%", h: "100%", align: "start", gap: 0, hideFrom: "md", children: [
50374
- !isMobileChainsOpen && !isPreconfigured && /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "100%", px: 2, pb: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(
50374
+ !isMobileChainsOpen && /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "100%", px: 2, pb: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(
50375
50375
  react.HStack,
50376
50376
  {
50377
50377
  w: "100%",
@@ -50892,7 +50892,7 @@ var DesktopContent = ({
50892
50892
  }
50893
50893
  ),
50894
50894
  /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { flex: 1, py: 3.5, align: "start", h: "100%", w: 0, children: [
50895
- !isPreconfigured && /* @__PURE__ */ jsxRuntime.jsx(
50895
+ /* @__PURE__ */ jsxRuntime.jsx(
50896
50896
  SearchInput,
50897
50897
  {
50898
50898
  placeholder: "Search for a token or contract address",
@@ -51474,6 +51474,21 @@ var TokenSelectAndInput = ({
51474
51474
  }
51475
51475
  );
51476
51476
  }, [solanaWalletKey]);
51477
+ const renderDefaultWalletIcon = React5.useCallback(() => {
51478
+ return /* @__PURE__ */ jsxRuntime.jsx(
51479
+ react.Box,
51480
+ {
51481
+ boxSize: {
51482
+ base: "12px",
51483
+ md: "14px"
51484
+ },
51485
+ borderRadius: "full",
51486
+ overflow: "hidden",
51487
+ bg: "white",
51488
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.Image, { src: defaultIcon, alt: "connector", w: "100%", h: "100%" })
51489
+ }
51490
+ );
51491
+ }, []);
51477
51492
  React5.useEffect(() => {
51478
51493
  if (isFrom) {
51479
51494
  const { tags } = tokenInfo;
@@ -51559,12 +51574,22 @@ var TokenSelectAndInput = ({
51559
51574
  isNativeSOL ? void 0 : tokenInfo.isSolana ? tokenInfo.address : void 0,
51560
51575
  tokenInfo.isSolana
51561
51576
  );
51577
+ const { data: solanaFixedAddressBalance } = useSolanaTokenBalance(
51578
+ isNativeSOL ? void 0 : tokenInfo.isSolana ? tokenInfo.address : void 0,
51579
+ !isFrom && tokenInfo.isSolana && !!config?.solanaDifferentAddress,
51580
+ config?.solanaDifferentAddress || void 0
51581
+ );
51562
51582
  const displayBalance = React5.useMemo(() => {
51563
- if (!isFrom && tokenInfo.isSolana && solanaBalance) {
51564
- return solanaBalance.formatted;
51583
+ if (!isFrom && tokenInfo.isSolana) {
51584
+ if (config?.solanaDifferentAddress && solanaFixedAddressBalance) {
51585
+ return solanaFixedAddressBalance.formatted;
51586
+ }
51587
+ if (solanaBalance) {
51588
+ return solanaBalance.formatted;
51589
+ }
51565
51590
  }
51566
51591
  return differentAddressBalance;
51567
- }, [isFrom, tokenInfo.isSolana, solanaBalance, differentAddressBalance]);
51592
+ }, [isFrom, tokenInfo.isSolana, config?.solanaDifferentAddress, solanaFixedAddressBalance, solanaBalance, differentAddressBalance]);
51568
51593
  React5.useEffect(() => {
51569
51594
  if (isFrom) {
51570
51595
  setFromAmountToUsd(usdValue);
@@ -51647,7 +51672,7 @@ var TokenSelectAndInput = ({
51647
51672
  if (!address && !solanaWalletAddress) {
51648
51673
  if (isSolanaChain2(toTokenInfo.chain_id) && config?.solanaDifferentAddress) {
51649
51674
  return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51650
- renderSolanaWalletIcon(),
51675
+ renderDefaultWalletIcon(),
51651
51676
  /* @__PURE__ */ jsxRuntime.jsx(
51652
51677
  Text2,
51653
51678
  {
@@ -51662,7 +51687,7 @@ var TokenSelectAndInput = ({
51662
51687
  }
51663
51688
  if (!isSolanaChain2(toTokenInfo.chain_id) && config?.evmDifferentAddress) {
51664
51689
  return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51665
- walletIcon,
51690
+ renderDefaultWalletIcon(),
51666
51691
  /* @__PURE__ */ jsxRuntime.jsx(
51667
51692
  Text2,
51668
51693
  {
@@ -51717,7 +51742,7 @@ var TokenSelectAndInput = ({
51717
51742
  if (!fromTokenInfo.isSolana && isSolanaChain2(toTokenInfo.chain_id) || fromTokenInfo.isSolana && isSolanaChain2(toTokenInfo.chain_id)) {
51718
51743
  if (config?.solanaDifferentAddress) {
51719
51744
  return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51720
- renderSolanaWalletIcon(),
51745
+ renderDefaultWalletIcon(),
51721
51746
  /* @__PURE__ */ jsxRuntime.jsx(
51722
51747
  Text2,
51723
51748
  {
@@ -51767,11 +51792,26 @@ var TokenSelectAndInput = ({
51767
51792
  }
51768
51793
  } else if (!address && solanaWalletAddress) {
51769
51794
  if (!fromTokenInfo.isSolana && isSolanaChain2(toTokenInfo.chain_id) || fromTokenInfo.isSolana && isSolanaChain2(toTokenInfo.chain_id)) {
51795
+ if (config?.solanaDifferentAddress) {
51796
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51797
+ renderDefaultWalletIcon(),
51798
+ /* @__PURE__ */ jsxRuntime.jsx(
51799
+ Text2,
51800
+ {
51801
+ variant: "content8",
51802
+ backgroundColor: theme.highlightBgColor,
51803
+ padding: "2px",
51804
+ color: theme.highlightTextColor,
51805
+ children: sliceAddress(config.solanaDifferentAddress)
51806
+ }
51807
+ )
51808
+ ] });
51809
+ }
51770
51810
  return renderSolanaAddress(solanaWalletAddress);
51771
51811
  } else {
51772
51812
  if (config?.evmDifferentAddress) {
51773
51813
  return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51774
- walletIcon,
51814
+ renderDefaultWalletIcon(),
51775
51815
  /* @__PURE__ */ jsxRuntime.jsx(
51776
51816
  Text2,
51777
51817
  {
@@ -51821,10 +51861,72 @@ var TokenSelectAndInput = ({
51821
51861
  }
51822
51862
  } else if (address && solanaWalletAddress) {
51823
51863
  if (isSolanaChain2(toTokenInfo.chain_id)) {
51864
+ if (config?.solanaDifferentAddress) {
51865
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51866
+ renderDefaultWalletIcon(),
51867
+ /* @__PURE__ */ jsxRuntime.jsx(
51868
+ Text2,
51869
+ {
51870
+ variant: "content8",
51871
+ backgroundColor: theme.highlightBgColor,
51872
+ padding: "2px",
51873
+ color: theme.highlightTextColor,
51874
+ children: sliceAddress(config.solanaDifferentAddress)
51875
+ }
51876
+ )
51877
+ ] });
51878
+ }
51824
51879
  return renderSolanaAddress(solanaWalletAddress);
51825
51880
  }
51881
+ if (config?.evmDifferentAddress) {
51882
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51883
+ renderDefaultWalletIcon(),
51884
+ /* @__PURE__ */ jsxRuntime.jsx(
51885
+ Text2,
51886
+ {
51887
+ variant: "content8",
51888
+ backgroundColor: theme.highlightBgColor,
51889
+ padding: "2px",
51890
+ color: theme.highlightTextColor,
51891
+ children: sliceAddress(config.evmDifferentAddress)
51892
+ }
51893
+ )
51894
+ ] });
51895
+ }
51826
51896
  return renderEvmAddress(address);
51827
51897
  }
51898
+ if (!isFrom) {
51899
+ if (isSolanaChain2(toTokenInfo.chain_id) && config?.solanaDifferentAddress) {
51900
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51901
+ renderDefaultWalletIcon(),
51902
+ /* @__PURE__ */ jsxRuntime.jsx(
51903
+ Text2,
51904
+ {
51905
+ variant: "content8",
51906
+ backgroundColor: theme.highlightBgColor,
51907
+ padding: "2px",
51908
+ color: theme.highlightTextColor,
51909
+ children: sliceAddress(config.solanaDifferentAddress)
51910
+ }
51911
+ )
51912
+ ] });
51913
+ }
51914
+ if (!isSolanaChain2(toTokenInfo.chain_id) && config?.evmDifferentAddress) {
51915
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51916
+ renderDefaultWalletIcon(),
51917
+ /* @__PURE__ */ jsxRuntime.jsx(
51918
+ Text2,
51919
+ {
51920
+ variant: "content8",
51921
+ backgroundColor: theme.highlightBgColor,
51922
+ padding: "2px",
51923
+ color: theme.highlightTextColor,
51924
+ children: sliceAddress(config.evmDifferentAddress)
51925
+ }
51926
+ )
51927
+ ] });
51928
+ }
51929
+ }
51828
51930
  return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1, children: [
51829
51931
  walletIcon,
51830
51932
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -53282,6 +53384,11 @@ var FormBody = ({
53282
53384
  isToNativeSOL ? void 0 : toTokenInfo.isSolana ? toTokenInfo.address : void 0,
53283
53385
  toTokenInfo.isSolana
53284
53386
  );
53387
+ const toTokenFixedSolanaBalance = useSolanaTokenBalance(
53388
+ isToNativeSOL ? void 0 : toTokenInfo.isSolana ? toTokenInfo.address : void 0,
53389
+ toTokenInfo.isSolana && !!config?.solanaDifferentAddress,
53390
+ config?.solanaDifferentAddress || void 0
53391
+ );
53285
53392
  const fromTokenBalance = React5.useMemo(() => {
53286
53393
  if (fromTokenInfo.isSolana) {
53287
53394
  return fromTokenBalanceSolana.data ? {
@@ -53300,6 +53407,13 @@ var FormBody = ({
53300
53407
  ]);
53301
53408
  const toTokenBalance = React5.useMemo(() => {
53302
53409
  if (toTokenInfo.isSolana) {
53410
+ if (config?.solanaDifferentAddress && toTokenFixedSolanaBalance.data) {
53411
+ return {
53412
+ decimals: toTokenFixedSolanaBalance.data.decimals,
53413
+ value: toTokenFixedSolanaBalance.data.value,
53414
+ formatted: toTokenFixedSolanaBalance.data.formatted
53415
+ };
53416
+ }
53303
53417
  if (toTokenBalanceSolana.data) {
53304
53418
  return {
53305
53419
  decimals: toTokenBalanceSolana.data.decimals,
@@ -53310,17 +53424,18 @@ var FormBody = ({
53310
53424
  return void 0;
53311
53425
  }
53312
53426
  if (isToHyperChain) return toTokenBalanceHyper;
53313
- if (!address && config?.evmDifferentAddress && toTokenFixedEvmBalance) {
53427
+ if (config?.evmDifferentAddress && toTokenFixedEvmBalance) {
53314
53428
  return toTokenFixedEvmBalance;
53315
53429
  }
53316
53430
  return toTokenBalanceNormal;
53317
53431
  }, [
53318
53432
  toTokenInfo.isSolana,
53433
+ config?.solanaDifferentAddress,
53434
+ toTokenFixedSolanaBalance.data,
53319
53435
  toTokenBalanceSolana.data,
53320
53436
  isToHyperChain,
53321
53437
  toTokenBalanceHyper,
53322
53438
  toTokenBalanceNormal,
53323
- address,
53324
53439
  config?.evmDifferentAddress,
53325
53440
  toTokenFixedEvmBalance
53326
53441
  ]);