@getpara/react-sdk-lite 2.0.0-alpha.47 → 2.0.0-alpha.49

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.
@@ -117,7 +117,7 @@ const ParaModal = forwardRef((props, ref) => {
117
117
  });
118
118
  trackAnalytics();
119
119
  }, []);
120
- const isOpen = configIsOpen != null ? configIsOpen : storedIsOpen;
120
+ const isOpen = bareModal || (configIsOpen != null ? configIsOpen : storedIsOpen);
121
121
  useImperativeHandle(ref, () => {
122
122
  return {
123
123
  goBack() {
@@ -21,6 +21,7 @@ const ExternalWalletMobileConnect = ({
21
21
  isSelfFetching = false
22
22
  }) => {
23
23
  var _a, _b;
24
+ const externalWalletError = useModalStore((state) => state.externalWalletError);
24
25
  const [isCopied, copy] = useCopyToClipboard();
25
26
  const appName = useStore((state) => state.appName);
26
27
  const [qrUri, setQrUri] = useState(isSelfFetching ? void 0 : propsQrUri);
@@ -43,10 +44,28 @@ const ExternalWalletMobileConnect = ({
43
44
  useEffect(() => {
44
45
  setQrUri(propsQrUri);
45
46
  }, [propsQrUri]);
47
+ const isError = !!(externalWalletError == null ? void 0 : externalWalletError[0]);
46
48
  if (wallet.type === "SOLANA" || isMobile() && !isTablet()) {
47
49
  return /* @__PURE__ */ jsxs(Fragment, { children: [
48
- wallet.type === "SOLANA" && qrUri && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: `Continue in the ${wallet.name} mobile app.` }) }),
50
+ wallet.type === "SOLANA" && qrUri && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(
51
+ HeroSpinner,
52
+ {
53
+ icon: /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: wallet.internalId, src: wallet ? wallet.iconUrl : void 0 }),
54
+ status: isError ? "error" : "pending",
55
+ text: isError ? externalWalletError[0] : `Continue in the ${wallet.name} mobile app.`,
56
+ secondaryText: externalWalletError == null ? void 0 : externalWalletError[1]
57
+ }
58
+ ) }),
49
59
  wallet.id !== "WalletConnect" && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
60
+ /* @__PURE__ */ jsx(
61
+ HeroSpinner,
62
+ {
63
+ icon: /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: wallet.internalId, src: wallet ? wallet.iconUrl : void 0 }),
64
+ status: isError ? "error" : "pending",
65
+ text: isError ? externalWalletError[0] : `Confirm connection request in the ${wallet.name} app.`,
66
+ secondaryText: externalWalletError == null ? void 0 : externalWalletError[1]
67
+ }
68
+ ),
50
69
  wallet.type === "SOLANA" && qrUri && !wallet.hasIosSafariExtension || wallet.type !== "SOLANA" ? /* @__PURE__ */ jsx(CpslButton, { onClick: () => routeMobileExternalWallet(qrUri), fullWidth: true, children: "Connect Wallet" }) : /* @__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.` }),
51
70
  !wallet.hasIosSafariExtension && /* @__PURE__ */ jsx(Link, { href: (_a = wallet.downloadUrl) != null ? _a : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", children: [
52
71
  `Get ${wallet.name}`,
@@ -9,7 +9,7 @@ import { useExternalWallets } from "../../../provider/providers/ExternalWalletPr
9
9
  import { useEffect, useRef } from "react";
10
10
  const ExternalWalletVerificationStep = () => {
11
11
  const effectRan = useRef(false);
12
- const { verifyWalletSignature } = useExternalWallets();
12
+ const { verifyWalletSignature, verificationStage } = useExternalWallets();
13
13
  const externalWalletError = useModalStore((state) => state.externalWalletError);
14
14
  useEffect(() => {
15
15
  const hasRun = effectRan.current;
@@ -18,10 +18,13 @@ const ExternalWalletVerificationStep = () => {
18
18
  effectRan.current = true;
19
19
  }
20
20
  }, []);
21
+ const isVerifying = verificationStage === "verifying";
22
+ const header = isVerifying ? "Verifying Your Wallet" : "Switching Network";
23
+ const subheader = isVerifying ? "Sign the message with your wallet to complete sign up." : "Confirm the request to switch the network in your wallet.";
21
24
  return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
22
25
  /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
23
- /* @__PURE__ */ jsx(Heading, { children: "Verify Your Wallet" }),
24
- /* @__PURE__ */ jsx(InlineText, { variant: "bodyS", color: "secondary", children: "Sign the message with your wallet to complete sign up." }),
26
+ /* @__PURE__ */ jsx(Heading, { children: header }),
27
+ /* @__PURE__ */ jsx(InlineText, { variant: "bodyS", color: "secondary", children: subheader }),
25
28
  !!(externalWalletError == null ? void 0 : externalWalletError[0]) && /* @__PURE__ */ jsxs(ErrorContainer, { children: [
26
29
  /* @__PURE__ */ jsx(ErrorIcon, { icon: "alertCircle" }),
27
30
  /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: externalWalletError == null ? void 0 : externalWalletError[0] })
@@ -126,7 +126,7 @@ const BODY_MOTION_VARIANTS = {
126
126
  const BODY_TRANSITION = {
127
127
  duration: 0.2
128
128
  };
129
- const SDK_VERSION = "2.0.0-alpha.47";
129
+ const SDK_VERSION = "2.0.0-alpha.48";
130
130
  export {
131
131
  BODY_MOTION_VARIANTS,
132
132
  BODY_TRANSITION,
@@ -34,6 +34,7 @@ export declare const defaultExternalWallet: {
34
34
  requestInfo: (_: string) => Promise<ExternalWalletInfo>;
35
35
  disconnectBase: (_: string, __: TWalletType) => Promise<void>;
36
36
  connectFarcasterMiniApp: () => Promise<void>;
37
+ verificationStage: undefined;
37
38
  };
38
39
  type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo' | 'disconnectBase'> & ChainManagement<string, void> & BalanceManagement & {
39
40
  wallet?: CommonWallet;
@@ -55,6 +56,7 @@ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 's
55
56
  requestInfo: (_: string, __: TWalletType) => Promise<ExternalWalletInfo>;
56
57
  disconnectBase: (_: string, __: TWalletType) => Promise<void>;
57
58
  connectFarcasterMiniApp: () => Promise<void>;
59
+ verificationStage?: 'verifying' | 'switchingChain';
58
60
  };
59
61
  export declare const ExternalWalletContext: import("react").Context<Value>;
60
62
  export declare function ExternalWalletProvider({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -47,7 +47,8 @@ const defaultExternalWallet = {
47
47
  getWalletBalance: () => Promise.resolve(void 0),
48
48
  requestInfo: (_) => Promise.resolve({}),
49
49
  disconnectBase: (_, __) => Promise.resolve(),
50
- connectFarcasterMiniApp: () => Promise.resolve()
50
+ connectFarcasterMiniApp: () => Promise.resolve(),
51
+ verificationStage: void 0
51
52
  };
52
53
  const ExternalWalletContext = createContext(defaultExternalWallet);
53
54
  function ExternalWalletProvider({ children }) {
@@ -76,7 +77,8 @@ function ExternalWalletProvider({ children }) {
76
77
  getWalletBalance: evmGetWalletBalance,
77
78
  requestInfo: evmRequestInfo,
78
79
  disconnectBase: evmDisconnectBase,
79
- farcasterStatus: evmFarcasterStatus
80
+ farcasterStatus: evmFarcasterStatus,
81
+ verificationStage: evmVerificationStage
80
82
  } = useContext(evmContext);
81
83
  const {
82
84
  wallets: solanaWallets,
@@ -187,6 +189,18 @@ function ExternalWalletProvider({ children }) {
187
189
  }
188
190
  }
189
191
  }, [cosmosChains, evmChains, selectedExternalWallet]);
192
+ const verificationStage = useMemo(() => {
193
+ var _a;
194
+ const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
195
+ switch (walletType) {
196
+ case "EVM": {
197
+ return evmVerificationStage;
198
+ }
199
+ default: {
200
+ return "verifying";
201
+ }
202
+ }
203
+ }, [selectedExternalWallet, evmVerificationStage]);
190
204
  const switchChain = useCallback(
191
205
  (chainId2) => __async(this, null, function* () {
192
206
  var _a;
@@ -245,6 +259,7 @@ function ExternalWalletProvider({ children }) {
245
259
  const { address, signature, error, cosmosPublicKeyHex, cosmosSigner, addressBech32 } = yield cosmosSignVerificationMessage();
246
260
  if (error) {
247
261
  setExternalWalletError([error]);
262
+ return;
248
263
  } else if (signature && address) {
249
264
  verifyExternalWalletParams = {
250
265
  externalWallet: __spreadValues({
@@ -265,6 +280,7 @@ function ExternalWalletProvider({ children }) {
265
280
  const { signature, error, address } = yield evmSignVerificationMessage();
266
281
  if (error) {
267
282
  setExternalWalletError([error]);
283
+ return;
268
284
  } else if (signature && address) {
269
285
  verifyExternalWalletParams = {
270
286
  externalWallet: __spreadValues({
@@ -282,6 +298,7 @@ function ExternalWalletProvider({ children }) {
282
298
  const { signature, error, address } = yield solanaSignVerificationMessage();
283
299
  if (error) {
284
300
  setExternalWalletError([error]);
301
+ return;
285
302
  } else if (signature && address) {
286
303
  verifyExternalWalletParams = {
287
304
  externalWallet: __spreadValues({
@@ -585,7 +602,8 @@ function ExternalWalletProvider({ children }) {
585
602
  getWalletBalance,
586
603
  requestInfo,
587
604
  disconnectBase,
588
- connectFarcasterMiniApp
605
+ connectFarcasterMiniApp,
606
+ verificationStage
589
607
  }),
590
608
  [
591
609
  wallets,
@@ -608,7 +626,8 @@ function ExternalWalletProvider({ children }) {
608
626
  getWalletBalance,
609
627
  requestInfo,
610
628
  disconnectBase,
611
- connectFarcasterMiniApp
629
+ connectFarcasterMiniApp,
630
+ verificationStage
612
631
  ]
613
632
  ),
614
633
  children
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.47",
3
+ "version": "2.0.0-alpha.49",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.47",
9
- "@getpara/react-components": "2.0.0-alpha.47",
10
- "@getpara/web-sdk": "2.0.0-alpha.47",
8
+ "@getpara/react-common": "2.0.0-alpha.49",
9
+ "@getpara/react-components": "2.0.0-alpha.49",
10
+ "@getpara/web-sdk": "2.0.0-alpha.49",
11
11
  "date-fns": "^3.6.0",
12
12
  "framer-motion": "^11.3.31",
13
13
  "libphonenumber-js": "^1.11.7",
@@ -16,9 +16,9 @@
16
16
  "zustand-sync-tabs": "^0.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.47",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.47",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.47",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.49",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.49",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.49",
22
22
  "@tanstack/react-query": "^5.74.0",
23
23
  "@testing-library/dom": "^10.4.0",
24
24
  "@testing-library/react": "^16.3.0",
@@ -38,7 +38,7 @@
38
38
  "package.json",
39
39
  "styles.css"
40
40
  ],
41
- "gitHead": "c26d1830f6e63b34f33b5c799795c8c7cb00bb5a",
41
+ "gitHead": "e6d48c1a805daa0ce5152663970066e94e7463ec",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",