@getpara/react-sdk-lite 2.19.0 → 2.21.0

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/cli/cli.mjs CHANGED
File without changes
@@ -99,7 +99,7 @@ const ParaModal = forwardRef((props, ref) => {
99
99
  onClose,
100
100
  defaultAuthIdentifier
101
101
  }), rest),
102
- reactSdkVersion: "2.19.0"
102
+ reactSdkVersion: "2.21.0"
103
103
  });
104
104
  } catch (e) {
105
105
  }
@@ -14,7 +14,8 @@ import { useStore } from "../../../../../provider/stores/useStore.js";
14
14
  const GENERIC_WALLET = {
15
15
  EVM: "Ethereum or EVM-based networks",
16
16
  SOLANA: "Solana or SVM-based networks",
17
- COSMOS: "Cosmos networks"
17
+ COSMOS: "Cosmos networks",
18
+ STELLAR: "the Stellar network"
18
19
  };
19
20
  const AddFundsReceive = () => {
20
21
  const { networks } = useAddFunds();
@@ -18,7 +18,7 @@ import { useProfileBalance, useWalletState } from "../../../../../provider/index
18
18
  import { useSendMutations } from "../../../../hooks/index.js";
19
19
  import { useStore } from "../../../../../provider/stores/useStore.js";
20
20
  const getDefaultSendMetadata = (balances, wallet) => {
21
- if (!balances || !(wallet == null ? void 0 : wallet.type) || !(wallet == null ? void 0 : wallet.address) || (wallet == null ? void 0 : wallet.type) === "COSMOS") {
21
+ if (!balances || !(wallet == null ? void 0 : wallet.type) || !(wallet == null ? void 0 : wallet.address) || (wallet == null ? void 0 : wallet.type) === "COSMOS" || (wallet == null ? void 0 : wallet.type) === "STELLAR") {
22
22
  return { asset: null, network: null };
23
23
  }
24
24
  const walletBalance = balances.wallets.find(({ address }) => address === (wallet == null ? void 0 : wallet.address));
@@ -133,7 +133,7 @@ function AccountSendProvider({ children, step }) {
133
133
  broadcastMutate
134
134
  ]);
135
135
  const availableWallets = useMemo(() => {
136
- return para.availableWallets.filter(({ type }) => type !== "COSMOS");
136
+ return para.availableWallets.filter(({ type }) => type !== "COSMOS" && type !== "STELLAR");
137
137
  }, [para.availableWallets]);
138
138
  const { assetPrice, assetValueOnNetwork, assetAmountOnNetwork } = useMemo(() => {
139
139
  var _a2, _b2, _c2, _d2, _e2, _f2, _g;
@@ -152,7 +152,7 @@ function AccountSendProvider({ children, step }) {
152
152
  };
153
153
  }, [sendMetadata.asset, sendMetadata.network]);
154
154
  useEffect(() => {
155
- if (availableWallets.length > 0 && selectedWallet.type === "COSMOS") {
155
+ if (availableWallets.length > 0 && (selectedWallet.type === "COSMOS" || selectedWallet.type === "STELLAR")) {
156
156
  const defaultWallet = availableWallets.find((wallet) => wallet.type !== "EVM");
157
157
  (defaultWallet == null ? void 0 : defaultWallet.id) && (defaultWallet == null ? void 0 : defaultWallet.type) && setSelectedWallet(defaultWallet);
158
158
  }
@@ -269,7 +269,7 @@ function AccountSendProvider({ children, step }) {
269
269
  walletId: selectedWallet.id,
270
270
  userId: para.userId,
271
271
  opts: {
272
- type: selectedWallet.type === "COSMOS" ? "EVM" : selectedWallet.type,
272
+ type: selectedWallet.type === "COSMOS" ? "EVM" : selectedWallet.type === "STELLAR" ? "SOLANA" : selectedWallet.type,
273
273
  config: balancesConfig,
274
274
  sourceAddress: selectedWallet.address,
275
275
  destinationAddress,
@@ -22,6 +22,10 @@ const EXPLORERS = {
22
22
  COSMOS: {
23
23
  name: "Atomscan",
24
24
  url: (address) => `https://atomscan.com/accounts/${address}`
25
+ },
26
+ STELLAR: {
27
+ name: "Stellar Expert",
28
+ url: (address) => `https://stellar.expert/explorer/public/account/${address}`
25
29
  }
26
30
  };
27
31
  const Wallet = () => {
@@ -5,27 +5,12 @@ import {
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
7
7
  import { CenteredText, HeroAccountTypeIcon, InnerStepContainer, QRContainer, StepContainer } from "../../common.js";
8
- import { useCallback, useMemo } from "react";
8
+ import { useCallback, useEffect, useMemo, useState } from "react";
9
9
  import { HeroSpinner, openMobileUrl, safeStyled } from "@getpara/react-common";
10
10
  import { useCopyToClipboard } from "@getpara/react-common";
11
11
  import { isMobile, isTablet } from "@getpara/web-sdk";
12
- import { useExternalWallets } from "../../../../provider/providers/ExternalWalletProvider.js";
12
+ import { isSolanaWalletInAppBrowser, useExternalWallets } from "../../../../provider/providers/ExternalWalletProvider.js";
13
13
  import { useStore } from "../../../../provider/stores/useStore.js";
14
- const isSolanaWalletInAppBrowser = (wallet) => {
15
- var _a;
16
- switch (wallet) {
17
- case "PHANTOM":
18
- return !!((_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.solana);
19
- case "SOLFLARE":
20
- return !!(window == null ? void 0 : window.solflare);
21
- case "BACKPACK":
22
- return !!(window == null ? void 0 : window.backpack);
23
- case "GLOW":
24
- return !!(window == null ? void 0 : window.glowSolana);
25
- default:
26
- break;
27
- }
28
- };
29
14
  const ExternalWalletMobileConnect = ({
30
15
  wallet,
31
16
  onConnectWc,
@@ -37,6 +22,16 @@ const ExternalWalletMobileConnect = ({
37
22
  const appName = useStore((state) => state.appName);
38
23
  const isWalletConnect = wallet.id === "WalletConnect";
39
24
  const { qrUri } = useExternalWallets();
25
+ const [isInAppBrowser, setIsInAppBrowser] = useState(() => !!isSolanaWalletInAppBrowser(wallet.internalId));
26
+ useEffect(() => {
27
+ setIsInAppBrowser(!!isSolanaWalletInAppBrowser(wallet.internalId));
28
+ const timer = setTimeout(() => {
29
+ if (isSolanaWalletInAppBrowser(wallet.internalId)) {
30
+ setIsInAppBrowser(true);
31
+ }
32
+ }, 500);
33
+ return () => clearTimeout(timer);
34
+ }, [wallet.internalId]);
40
35
  const handleCopy = () => {
41
36
  if (qrUri) {
42
37
  copy(qrUri);
@@ -52,7 +47,7 @@ const ExternalWalletMobileConnect = ({
52
47
  });
53
48
  if (wallet.type === "SOLANA" || isMobile() && !isTablet()) {
54
49
  return /* @__PURE__ */ jsxs(Fragment, { children: [
55
- wallet.type === "SOLANA" && !!qrUri && !isSolanaWalletInAppBrowser(wallet.internalId) && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(
50
+ wallet.type === "SOLANA" && !!qrUri && !isInAppBrowser && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(
56
51
  HeroSpinner,
57
52
  {
58
53
  icon: /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: wallet.internalId, src: wallet ? wallet.iconUrl : void 0 }),
@@ -66,12 +61,12 @@ const ExternalWalletMobileConnect = ({
66
61
  HeroSpinner,
67
62
  {
68
63
  icon: /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: wallet.internalId, src: wallet ? wallet.iconUrl : void 0 }),
69
- status: wallet.type === "SOLANA" && !isSolanaWalletInAppBrowser(wallet.internalId) ? "idle" : isError ? "error" : "pending",
70
- text: wallet.type === "SOLANA" && (!isSolanaWalletInAppBrowser(wallet.internalId) || wallet.hasIosSafariExtension) ? "" : isError ? externalWalletError[0] : `Confirm connection request in the ${wallet.name} app.`,
64
+ status: wallet.type === "SOLANA" && !isInAppBrowser ? "idle" : isError ? "error" : "pending",
65
+ text: wallet.type === "SOLANA" && (!isInAppBrowser || wallet.hasIosSafariExtension) ? "" : isError ? externalWalletError[0] : `Confirm connection request in the ${wallet.name} app.`,
71
66
  secondaryText: externalWalletError == null ? void 0 : externalWalletError[1]
72
67
  }
73
68
  ),
74
- wallet.type === "SOLANA" && isSolanaWalletInAppBrowser(wallet.internalId) && !wallet.hasIosSafariExtension || wallet.type !== "SOLANA" ? /* @__PURE__ */ jsx(
69
+ wallet.type === "SOLANA" && isInAppBrowser && !wallet.hasIosSafariExtension || wallet.type !== "SOLANA" ? /* @__PURE__ */ jsx(
75
70
  CpslButton,
76
71
  {
77
72
  onClick: handleRetryClick,
@@ -80,7 +75,7 @@ const ExternalWalletMobileConnect = ({
80
75
  children: isError ? "Retry" : "Connect Wallet"
81
76
  }
82
77
  ) : /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: wallet.hasIosSafariExtension ? `Please install and use the ${wallet.name} extension for iOS Safari.` : `Please navigate to ${appName} in the ${wallet.name} wallet.` }),
83
- !wallet.hasIosSafariExtension && /* @__PURE__ */ jsx(Link, { href: (_a = wallet.downloadUrl) != null ? _a : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", "data-testid": "para-wallet-get", children: [
78
+ !wallet.hasIosSafariExtension && !isInAppBrowser && /* @__PURE__ */ jsx(Link, { href: (_a = wallet.downloadUrl) != null ? _a : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", "data-testid": "para-wallet-get", children: [
84
79
  `Get ${wallet.name}`,
85
80
  /* @__PURE__ */ jsx(ExternalIcon, { icon: "linkExternal" })
86
81
  ] }) })
@@ -6,7 +6,8 @@ const WALLET_TYPE_CONFIG = {
6
6
  icon: "ethCircle"
7
7
  },
8
8
  SOLANA: { name: "Solana", icon: "solanaCircle" },
9
- COSMOS: { name: "Cosmos", icon: "cosmosCircle" }
9
+ COSMOS: { name: "Cosmos", icon: "cosmosCircle" },
10
+ STELLAR: { name: "Stellar", icon: "stellarCircle" }
10
11
  };
11
12
  export {
12
13
  WALLET_TYPE_CONFIG
@@ -5,7 +5,7 @@ import { TWalletType } from '@getpara/web-sdk';
5
5
  export declare const useWalletState: () => {
6
6
  selectedWallet: {
7
7
  id: string | undefined;
8
- type: "EVM" | "SOLANA" | "COSMOS" | undefined;
8
+ type: "EVM" | "SOLANA" | "COSMOS" | "STELLAR" | undefined;
9
9
  address: string | undefined;
10
10
  };
11
11
  setSelectedWallet: ({ id, type }: {
@@ -3,6 +3,7 @@ import { TWalletType } from '@getpara/web-sdk';
3
3
  import { BalanceManagement, ChainManagement, CommonWallet, DisconnectBaseOptions, ExternalWalletContextType, MutationStatus } from '@getpara/react-common';
4
4
  import { ExternalWalletInfo } from '@getpara/web-sdk';
5
5
  import { CosmosSignResult } from '@getpara/cosmos-wallet-connectors';
6
+ export declare const isSolanaWalletInAppBrowser: (walletId: string) => boolean;
6
7
  export declare const useWalletDisplayHelpers: (wallet: CommonWallet | undefined) => {
7
8
  showExtension: boolean;
8
9
  showMobile: boolean;
@@ -23,6 +23,23 @@ import {
23
23
  import { useGoBack } from "../../modal/hooks/useGoBack.js";
24
24
  import { validatePortalOrigin } from "../../modal/utils/validatePortalOrigin.js";
25
25
  import { DEFAULTS } from "../../modal/constants/defaults.js";
26
+ const isSolanaWalletInAppBrowser = (walletId) => {
27
+ var _a;
28
+ if (typeof window === "undefined") return false;
29
+ const w = window;
30
+ switch (walletId) {
31
+ case "PHANTOM":
32
+ return !!((_a = w == null ? void 0 : w.phantom) == null ? void 0 : _a.solana);
33
+ case "SOLFLARE":
34
+ return !!(w == null ? void 0 : w.solflare);
35
+ case "BACKPACK":
36
+ return !!(w == null ? void 0 : w.backpack);
37
+ case "GLOW":
38
+ return !!(w == null ? void 0 : w.glowSolana);
39
+ default:
40
+ return false;
41
+ }
42
+ };
26
43
  const useWalletDisplayHelpers = (wallet) => {
27
44
  const isUsingMobileConnector = useStore((state) => state.isUsingMobileConnector);
28
45
  return {
@@ -642,9 +659,10 @@ function ExternalWalletProvider({ children }) {
642
659
  clearExternalWalletConnectionRetryListener();
643
660
  handlePostConnectRetry();
644
661
  }
645
- if (!isMobile() && isWithFullAuth(wallet2) && !isManualWalletConnect) {
662
+ const isInDappBrowser = isSolanaWalletInAppBrowser(wallet2.internalId);
663
+ if (!(isMobile() || isInDappBrowser) && isWithFullAuth(wallet2) && !isManualWalletConnect) {
646
664
  const popupUrl = yield para.constructPortalUrl("connectExternalWallet");
647
- if (typeof window !== void 0) {
665
+ if (typeof window !== "undefined") {
648
666
  refs.popupWindow.current = openPopup({
649
667
  url: popupUrl,
650
668
  type: "LOGIN_EXTERNAL_WALLET",
@@ -962,6 +980,7 @@ export {
962
980
  ExternalWalletContext,
963
981
  ExternalWalletProvider,
964
982
  defaultExternalWallet,
983
+ isSolanaWalletInAppBrowser,
965
984
  useExternalWallets,
966
985
  useWalletDisplayHelpers
967
986
  };
@@ -1,4 +1,4 @@
1
1
  export declare const getClient: () => import("graz").ParaWeb | undefined;
2
2
  export declare const getIsOpen: () => boolean;
3
3
  export declare const getSelectedWalletId: () => string | undefined;
4
- export declare const getSelectedWalletType: () => "EVM" | "SOLANA" | "COSMOS" | undefined;
4
+ export declare const getSelectedWalletType: () => "EVM" | "SOLANA" | "COSMOS" | "STELLAR" | undefined;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.19.0",
3
+ "version": "2.21.0",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.19.0",
9
- "@getpara/react-components": "2.19.0",
10
- "@getpara/react-core": "2.19.0",
11
- "@getpara/web-sdk": "2.19.0",
8
+ "@getpara/react-common": "2.21.0",
9
+ "@getpara/react-components": "2.21.0",
10
+ "@getpara/react-core": "2.21.0",
11
+ "@getpara/web-sdk": "2.21.0",
12
12
  "date-fns": "^3.6.0",
13
13
  "detect-browser": "^5.3.0",
14
14
  "framer-motion": "^11.3.31",
@@ -19,19 +19,19 @@
19
19
  "zustand-sync-tabs": "^0.2.2"
20
20
  },
21
21
  "devDependencies": {
22
- "@getpara/aa-alchemy": "2.19.0",
23
- "@getpara/aa-biconomy": "2.19.0",
24
- "@getpara/aa-cdp": "2.19.0",
25
- "@getpara/aa-gelato": "2.19.0",
26
- "@getpara/aa-pimlico": "2.19.0",
27
- "@getpara/aa-porto": "2.19.0",
28
- "@getpara/aa-rhinestone": "2.19.0",
29
- "@getpara/aa-safe": "2.19.0",
30
- "@getpara/aa-thirdweb": "2.19.0",
31
- "@getpara/aa-zerodev": "2.19.0",
32
- "@getpara/cosmos-wallet-connectors": "2.19.0",
33
- "@getpara/evm-wallet-connectors": "2.19.0",
34
- "@getpara/solana-wallet-connectors": "2.19.0",
22
+ "@getpara/aa-alchemy": "2.21.0",
23
+ "@getpara/aa-biconomy": "2.21.0",
24
+ "@getpara/aa-cdp": "2.21.0",
25
+ "@getpara/aa-gelato": "2.21.0",
26
+ "@getpara/aa-pimlico": "2.21.0",
27
+ "@getpara/aa-porto": "2.21.0",
28
+ "@getpara/aa-rhinestone": "2.21.0",
29
+ "@getpara/aa-safe": "2.21.0",
30
+ "@getpara/aa-thirdweb": "2.21.0",
31
+ "@getpara/aa-zerodev": "2.21.0",
32
+ "@getpara/cosmos-wallet-connectors": "2.21.0",
33
+ "@getpara/evm-wallet-connectors": "2.21.0",
34
+ "@getpara/solana-wallet-connectors": "2.21.0",
35
35
  "@tanstack/react-query": "^5.74.0",
36
36
  "@testing-library/dom": "^10.4.0",
37
37
  "@testing-library/react": "^16.3.0",
@@ -51,7 +51,7 @@
51
51
  "package.json",
52
52
  "styles.css"
53
53
  ],
54
- "gitHead": "7dc9400777adb653c0cc28e0d9236424eb384467",
54
+ "gitHead": "61f68bb1344dcec458f9016db39f631bb630b8f4",
55
55
  "main": "dist/index.js",
56
56
  "peerDependencies": {
57
57
  "@getpara/aa-alchemy": ">=2.15.0",