@getpara/react-sdk 2.0.0-alpha.19 → 2.0.0-alpha.20
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.
|
@@ -13,9 +13,11 @@ import { ModalStep } from "../../utils/steps.js";
|
|
|
13
13
|
import { isMobile, isTablet } from "@getpara/web-sdk";
|
|
14
14
|
import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
|
|
15
15
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
16
17
|
const ExternalWalletStep = () => {
|
|
17
18
|
const [isCopied, copy] = useCopyToClipboard();
|
|
18
19
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
20
|
+
const appName = useStore((state) => state.appName);
|
|
19
21
|
const setStep = useModalStore((state) => state.setStep);
|
|
20
22
|
const { connectExternalWallet, wallet, qrUri, walletDisplayHelpers } = useExternalWallets();
|
|
21
23
|
useEffect(() => {
|
|
@@ -41,12 +43,11 @@ const ExternalWalletStep = () => {
|
|
|
41
43
|
if (isMobileWalletConnect) {
|
|
42
44
|
/* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: "Continue in the WalletConnect modal." }) });
|
|
43
45
|
}
|
|
44
|
-
const { showExtension, showMobile
|
|
45
|
-
if (!showMobile && !showExtension
|
|
46
|
-
|
|
46
|
+
const { showExtension, showMobile } = walletDisplayHelpers;
|
|
47
|
+
if (!showMobile && !showExtension) {
|
|
48
|
+
return /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: `${wallet.name} isn't supported on mobile devices.
|
|
47
49
|
|
|
48
|
-
Please choose another wallet or continue on desktop
|
|
49
|
-
return /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: text }) });
|
|
50
|
+
Please choose another wallet or continue on desktop.` }) });
|
|
50
51
|
}
|
|
51
52
|
if (showExtension) {
|
|
52
53
|
const isInstalled = wallet.installed;
|
|
@@ -73,12 +74,11 @@ Please choose another wallet or continue on desktop.`;
|
|
|
73
74
|
}
|
|
74
75
|
if (showMobile) {
|
|
75
76
|
if (wallet.type === "SOLANA" || isMobile() && !isTablet()) {
|
|
76
|
-
const isInstalled = wallet.type !== "SOLANA" || wallet.installed;
|
|
77
77
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
-
/* @__PURE__ */ jsx(InnerStepContainer, { children:
|
|
78
|
+
wallet.type === "SOLANA" && qrUri && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: `Continue in the ${wallet.name} mobile app.` }) }),
|
|
79
79
|
wallet.id !== "walletConnect" && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
80
|
-
/* @__PURE__ */ jsx(CpslButton, { onClick: () => routeMobileExternalWallet(qrUri), fullWidth: true, children: "Connect Wallet" }),
|
|
81
|
-
/* @__PURE__ */ jsx(Link, { href: (_b = wallet.downloadUrl) != null ? _b : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", children: [
|
|
80
|
+
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.` }),
|
|
81
|
+
!wallet.hasIosSafariExtension && /* @__PURE__ */ jsx(Link, { href: (_b = wallet.downloadUrl) != null ? _b : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", children: [
|
|
82
82
|
`Get ${wallet.name}`,
|
|
83
83
|
/* @__PURE__ */ jsx(ExternalIcon, { icon: "linkExternal" })
|
|
84
84
|
] }) })
|
|
@@ -11,7 +11,6 @@ export declare const defaultExternalWallet: {
|
|
|
11
11
|
walletDisplayHelpers: {
|
|
12
12
|
showExtension: boolean;
|
|
13
13
|
showMobile: boolean;
|
|
14
|
-
isSolanaMobileIOS: boolean;
|
|
15
14
|
isCosmosMobileWallet: boolean;
|
|
16
15
|
};
|
|
17
16
|
username: undefined;
|
|
@@ -35,7 +34,6 @@ export declare const ExternalWalletContext: import("react").Context<{
|
|
|
35
34
|
walletDisplayHelpers: {
|
|
36
35
|
showExtension: boolean;
|
|
37
36
|
showMobile: boolean;
|
|
38
|
-
isSolanaMobileIOS: boolean;
|
|
39
37
|
isCosmosMobileWallet: boolean;
|
|
40
38
|
};
|
|
41
39
|
username?: string;
|
|
@@ -60,7 +58,6 @@ export declare const useExternalWallets: () => {
|
|
|
60
58
|
walletDisplayHelpers: {
|
|
61
59
|
showExtension: boolean;
|
|
62
60
|
showMobile: boolean;
|
|
63
|
-
isSolanaMobileIOS: boolean;
|
|
64
61
|
isCosmosMobileWallet: boolean;
|
|
65
62
|
};
|
|
66
63
|
username?: string;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../../chunk-MMUBH76A.js";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { isMobile, truncateAddress } from "@getpara/web-sdk";
|
|
9
9
|
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
10
10
|
import { useStore } from "../stores/useStore.js";
|
|
11
11
|
import { ModalStep } from "../../modal/index.js";
|
|
@@ -19,7 +19,7 @@ const defaultExternalWallet = {
|
|
|
19
19
|
wallet: void 0,
|
|
20
20
|
qrUri: void 0,
|
|
21
21
|
chainIdSwitchingTo: void 0,
|
|
22
|
-
walletDisplayHelpers: { showExtension: false, showMobile: false,
|
|
22
|
+
walletDisplayHelpers: { showExtension: false, showMobile: false, isCosmosMobileWallet: false },
|
|
23
23
|
username: void 0,
|
|
24
24
|
avatar: void 0,
|
|
25
25
|
connectExternalWallet: () => Promise.resolve(),
|
|
@@ -325,7 +325,6 @@ function ExternalWalletProvider({ children }) {
|
|
|
325
325
|
showExtension: !isMobile() && ((wallet == null ? void 0 : wallet.isExtension) && (wallet == null ? void 0 : wallet.installed) || !(wallet == null ? void 0 : wallet.isMobile) || (wallet == null ? void 0 : wallet.type) === "SOLANA"),
|
|
326
326
|
// Show the mobile screen if on mobile and the wallet is a mobile wallet or if on desktop and the wallet isn't installed
|
|
327
327
|
showMobile: isMobile() && (wallet == null ? void 0 : wallet.isMobile) || !isMobile() && !(wallet == null ? void 0 : wallet.installed),
|
|
328
|
-
isSolanaMobileIOS: isIOS() && isMobile() && !isIOSWebview() && (wallet == null ? void 0 : wallet.type) === "SOLANA",
|
|
329
328
|
isCosmosMobileWallet: (wallet == null ? void 0 : wallet.type) === "COSMOS" && !!isUsingMobileConnector
|
|
330
329
|
};
|
|
331
330
|
const username = useMemo(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"*.css"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
19
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
20
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
18
|
+
"@getpara/react-common": "2.0.0-alpha.20",
|
|
19
|
+
"@getpara/react-components": "2.0.0-alpha.20",
|
|
20
|
+
"@getpara/web-sdk": "2.0.0-alpha.20",
|
|
21
21
|
"date-fns": "^3.6.0",
|
|
22
22
|
"framer-motion": "11.3.28",
|
|
23
23
|
"libphonenumber-js": "^1.11.1",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"cli": "node ./dist/cli/cli.mjs"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.
|
|
37
|
-
"@getpara/evm-wallet-connectors": "2.0.0-alpha.
|
|
38
|
-
"@getpara/solana-wallet-connectors": "2.0.0-alpha.
|
|
36
|
+
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.20",
|
|
37
|
+
"@getpara/evm-wallet-connectors": "2.0.0-alpha.20",
|
|
38
|
+
"@getpara/solana-wallet-connectors": "2.0.0-alpha.20",
|
|
39
39
|
"@testing-library/dom": "^10.4.0",
|
|
40
40
|
"@testing-library/react": "^16.3.0",
|
|
41
41
|
"@testing-library/react-hooks": "^8.0.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"resolutions": {
|
|
64
64
|
"styled-components": "^6"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "4c8d918b9fc387476968bfc08524fe1a8b6ec83b"
|
|
67
67
|
}
|