@getpara/react-sdk 2.0.0-alpha.15 → 2.0.0-alpha.17

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.
@@ -31,7 +31,7 @@ const Account = ({ onClose }) => {
31
31
  const { data: balance, isLoading: isBalanceLoading } = useWalletBalance();
32
32
  const [isDisconnecting, setIsDisconnecting] = useState(false);
33
33
  const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
34
- const cantBuyAndWithdraw = para.externalWalletConnectionType === "CONNECTION_ONLY" && !para.userId;
34
+ const cantBuyAndWithdraw = (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") && !para.userId;
35
35
  const isOnRampLoaded = !!onRampConfig;
36
36
  const handleBuyClick = () => {
37
37
  if (isGuestMode) {
@@ -9,7 +9,7 @@ import { OnRampProvider } from "@getpara/web-sdk";
9
9
  import { useModalStore } from "../../stores/index.js";
10
10
  import { lazy, useEffect, useMemo, useState } from "react";
11
11
  import { ModalStep } from "../../utils/steps.js";
12
- import { RampEmbed, StripeEmbed } from "@getpara/react-common";
12
+ import { RampEmbed } from "@getpara/react-common";
13
13
  import styled from "styled-components";
14
14
  import { useGoBack } from "../../hooks/useGoBack.js";
15
15
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
@@ -50,12 +50,12 @@ const AddFundsAwaiting = () => {
50
50
  return null;
51
51
  }
52
52
  switch (onRampPurchase == null ? void 0 : onRampPurchase.provider) {
53
- case OnRampProvider.STRIPE:
54
- return /* @__PURE__ */ jsx(StripeEmbed, __spreadProps(__spreadValues({}, props), { onRampConfig: props.onRampConfig }));
55
53
  case OnRampProvider.MOONPAY:
56
54
  return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx(MoonPayEmbed, __spreadProps(__spreadValues({}, props), { onRampConfig: props.onRampConfig }));
57
55
  case OnRampProvider.RAMP:
58
56
  return /* @__PURE__ */ jsx(RampEmbed, __spreadProps(__spreadValues({}, props), { apiKey: (_b = (_a = props.onRampConfig) == null ? void 0 : _a.rampApiKey) != null ? _b : "", onRampConfig: props.onRampConfig }));
57
+ default:
58
+ return null;
59
59
  }
60
60
  }, [onRampPurchase == null ? void 0 : onRampPurchase.provider, MoonPayEmbed]);
61
61
  useEffect(() => {
@@ -158,7 +158,7 @@ const phoneMasks = {
158
158
  NZ: "## ### ###",
159
159
  NI: "#### ####",
160
160
  NE: "## ## ## ##",
161
- NG: "## ### ####",
161
+ NG: "## #### ####",
162
162
  NU: "####",
163
163
  NF: "### ###",
164
164
  MK: "## ### ###",
@@ -34,7 +34,7 @@ const LoginDoneStep = ({ onClose }) => {
34
34
  return /* @__PURE__ */ jsxs(StepContainer, { children: [
35
35
  /* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
36
36
  /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Connected" }),
37
- !hideWallets && /* @__PURE__ */ jsx(WalletCards, { children: para.externalWalletConnectionType === "CONNECTION_ONLY" ? /* @__PURE__ */ jsx(ExternalWalletCard, { address: (_b = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address) != null ? _b : "" }) : para.currentWalletIdsArray.map(([id, type]) => {
37
+ !hideWallets && /* @__PURE__ */ jsx(WalletCards, { children: para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION" ? /* @__PURE__ */ jsx(ExternalWalletCard, { address: (_b = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address) != null ? _b : "" }) : para.currentWalletIdsArray.map(([id, type]) => {
38
38
  return /* @__PURE__ */ jsx(WalletCard, { id, type }, `${id}-${type}`);
39
39
  }) })
40
40
  ] });
@@ -30,7 +30,7 @@ export declare function getNetworkName(str: Network | string): string;
30
30
  export declare function getNetworkIcon(str: Network | string): IconType;
31
31
  export declare function getAssetCode(str: OnRampAsset | string): string;
32
32
  export declare function getAssetName(str: OnRampAsset | string): string;
33
- export declare function getAssetIcon(str: OnRampAsset | string): "key" | "phone" | "farcaster" | "telegram" | "discord" | "x" | "search" | "para" | "wallet" | "close" | "copy" | "cosmos" | "code" | "menu" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "copy07" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "googleBrand" | "google" | "gridDots" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "laptop" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solana" | "spacingHeight" | "star04Filled" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "user" | "youtubeBrand" | "youtube" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
33
+ export declare function getAssetIcon(str: OnRampAsset | string): "key" | "phone" | "farcaster" | "telegram" | "discord" | "x" | "search" | "para" | "wallet" | "close" | "copy" | "cosmos" | "code" | "menu" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "copy07" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "googleBrand" | "google" | "gridDots" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "laptop" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solana" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "user" | "youtubeBrand" | "youtube" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
34
34
  export declare const MOBILE_SIZE = 480;
35
35
  export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
36
36
  export declare const EMAIL_REGEX: RegExp;
@@ -119,7 +119,7 @@ const BODY_MOTION_VARIANTS = {
119
119
  const BODY_TRANSITION = {
120
120
  duration: 0.2
121
121
  };
122
- const SDK_VERSION = "2.0.0-alpha.13";
122
+ const SDK_VERSION = "2.0.0-alpha.17";
123
123
  export {
124
124
  BODY_MOTION_VARIANTS,
125
125
  BODY_TRANSITION,
@@ -5,7 +5,8 @@ export declare enum EvmWallet {
5
5
  WALLETCONNECT = "WALLETCONNECT",
6
6
  ZERION = "ZERION",
7
7
  SAFE = "SAFE",
8
- RABBY = "RABBY"
8
+ RABBY = "RABBY",
9
+ OKX = "OKX"
9
10
  }
10
11
  export declare enum SolanaWallet {
11
12
  PHANTOM = "PHANTOM",
@@ -29,5 +30,6 @@ export declare const ExternalWallet: {
29
30
  ZERION: EvmWallet.ZERION;
30
31
  SAFE: EvmWallet.SAFE;
31
32
  RABBY: EvmWallet.RABBY;
33
+ OKX: EvmWallet.OKX;
32
34
  };
33
35
  export type TExternalWallet = keyof typeof ExternalWallet;
@@ -10,6 +10,7 @@ var EvmWallet = /* @__PURE__ */ ((EvmWallet2) => {
10
10
  EvmWallet2["ZERION"] = "ZERION";
11
11
  EvmWallet2["SAFE"] = "SAFE";
12
12
  EvmWallet2["RABBY"] = "RABBY";
13
+ EvmWallet2["OKX"] = "OKX";
13
14
  return EvmWallet2;
14
15
  })(EvmWallet || {});
15
16
  var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
@@ -23,6 +23,10 @@ const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config
23
23
  const externalWallets = useStore((state) => state.externalWallets);
24
24
  const setExternalWalletsWithFullAuth = useStore((state) => state.setExternalWalletsWithFullAuth);
25
25
  const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
26
+ const setIncludeWalletVerification = useStore((state) => state.setIncludeWalletVerification);
27
+ const includeWalletVerification = useStore((state) => state.includeWalletVerification);
28
+ const setConnectionOnly = useStore((state) => state.setConnectionOnly);
29
+ const connectionOnly = useStore((state) => state.connectionOnly);
26
30
  const setModalConfig = useStore((state) => state.setModalConfig);
27
31
  const modalConfig = useStore((state) => state.modalConfig);
28
32
  const setAppName = useStore((state) => state.setAppName);
@@ -45,6 +49,23 @@ const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config
45
49
  useEffect(() => {
46
50
  if (modalConfig !== paraModalConfig) setModalConfig(paraModalConfig);
47
51
  }, [paraModalConfig]);
52
+ useEffect(() => {
53
+ var _a;
54
+ if (connectionOnly !== (externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly)) {
55
+ setConnectionOnly((_a = externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) != null ? _a : false);
56
+ }
57
+ }, [externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly]);
58
+ useEffect(() => {
59
+ var _a, _b;
60
+ if (includeWalletVerification !== (externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification)) {
61
+ if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly)) {
62
+ console.warn("includeWalletVerification has no effect when using connection only external wallets");
63
+ setIncludeWalletVerification(false);
64
+ } else {
65
+ setIncludeWalletVerification((_b = externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification) != null ? _b : false);
66
+ }
67
+ }
68
+ }, [externalWalletConfig == null ? void 0 : externalWalletConfig.includeWalletVerification]);
48
69
  useEffect(() => {
49
70
  var _a;
50
71
  if (externalWallets !== (externalWalletConfig == null ? void 0 : externalWalletConfig.wallets)) {
@@ -54,8 +75,8 @@ const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config
54
75
  useEffect(() => {
55
76
  var _a, _b;
56
77
  if (externalWalletsWithFullAuth !== (externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets)) {
57
- if (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly) {
58
- console.warn("createLinkedEmbeddedForExternalWallets has no effect when using externalWalletConnectionOnly");
78
+ if ((externalWalletConfig == null ? void 0 : externalWalletConfig.connectionOnly) || (isConfigType(paraClientConfig) ? (_a = paraClientConfig.opts) == null ? void 0 : _a.externalWalletConnectionOnly : paraClientConfig.externalWalletConnectionOnly)) {
79
+ console.warn("createLinkedEmbeddedForExternalWallets has no effect when using connection only external wallets");
59
80
  setExternalWalletsWithFullAuth([]);
60
81
  } else {
61
82
  setExternalWalletsWithFullAuth(
@@ -17,11 +17,20 @@ const CosmosWalletWrapper = ({
17
17
  const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
18
18
  const wallets = useStore((state) => state.externalWallets);
19
19
  const isUsing = wallets.some((w) => w in CosmosWallet);
20
+ const connectionOnly = useStore((state) => state.connectionOnly);
21
+ const includeWalletVerification = useStore((state) => state.includeWalletVerification);
20
22
  return /* @__PURE__ */ jsx(
21
23
  CosmosExternalWalletProvider,
22
24
  {
23
25
  config: cosmosConnectorConfig,
24
- internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth, connectedWallet: wallet },
26
+ internalConfig: {
27
+ onSwitchWallet,
28
+ para,
29
+ walletsWithFullAuth: externalWalletsWithFullAuth,
30
+ connectedWallet: wallet,
31
+ connectionOnly,
32
+ includeWalletVerification
33
+ },
25
34
  grazProviderProps,
26
35
  isUsing,
27
36
  wallets,
@@ -16,12 +16,21 @@ const EvmWalletWrapper = ({
16
16
  const { data: wallet } = useWallet();
17
17
  const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
18
18
  const wallets = useStore((state) => state.externalWallets);
19
+ const connectionOnly = useStore((state) => state.connectionOnly);
20
+ const includeWalletVerification = useStore((state) => state.includeWalletVerification);
19
21
  const isUsing = wallets.some((w) => w in EvmWallet);
20
22
  return /* @__PURE__ */ jsx(
21
23
  EvmExternalWalletProvider,
22
24
  {
23
25
  config: evmProviderConfig,
24
- internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth, connectedWallet: wallet },
26
+ internalConfig: {
27
+ onSwitchWallet,
28
+ para,
29
+ walletsWithFullAuth: externalWalletsWithFullAuth,
30
+ connectedWallet: wallet,
31
+ connectionOnly,
32
+ includeWalletVerification
33
+ },
25
34
  wagmiProviderProps,
26
35
  isUsing,
27
36
  wallets,
@@ -13,6 +13,8 @@ const SolanaWalletWrapper = ({
13
13
  const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
14
14
  const para = useInternalClient();
15
15
  const wallets = useStore((state) => state.externalWallets);
16
+ const connectionOnly = useStore((state) => state.connectionOnly);
17
+ const includeWalletVerification = useStore((state) => state.includeWalletVerification);
16
18
  const isUsing = wallets.some((w) => w in SolanaWallet);
17
19
  if (!solanaProviderConfig) {
18
20
  if (isUsing) {
@@ -24,7 +26,13 @@ const SolanaWalletWrapper = ({
24
26
  SolanaExternalWalletProvider,
25
27
  {
26
28
  config: solanaProviderConfig,
27
- internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth },
29
+ internalConfig: {
30
+ onSwitchWallet,
31
+ para,
32
+ walletsWithFullAuth: externalWalletsWithFullAuth,
33
+ connectionOnly,
34
+ includeWalletVerification
35
+ },
28
36
  isUsing,
29
37
  wallets,
30
38
  children
@@ -46,7 +46,7 @@ const useWalletBalance = (args) => {
46
46
  (selectedWallet == null ? void 0 : selectedWallet.isExternal) ? chainId : ""
47
47
  ],
48
48
  queryFn,
49
- enabled: !!selectedWallet && !!rpcUrl && !!(account == null ? void 0 : account.isConnected)
49
+ enabled: !!client && !!selectedWallet && !!rpcUrl && !!(account == null ? void 0 : account.isConnected)
50
50
  });
51
51
  };
52
52
  export {
@@ -9,6 +9,7 @@ import {
9
9
  import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
10
10
  import { useStore } from "../../stores/useStore.js";
11
11
  import { WALLET_BASE_KEY } from "../queries/useWallet.js";
12
+ import { WALLET_BALANCE_BASE_KEY } from "../queries/useWalletBalance.js";
12
13
  const useEventListeners = ({
13
14
  onLogin,
14
15
  onLogout,
@@ -28,6 +29,7 @@ const useEventListeners = ({
28
29
  const loginOrSetupListener = useCallback(() => {
29
30
  queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
30
31
  queryClient.refetchQueries({ queryKey: [WALLET_BASE_KEY] });
32
+ queryClient.invalidateQueries({ queryKey: [WALLET_BALANCE_BASE_KEY], exact: false });
31
33
  }, [queryClient]);
32
34
  const loginListener = useCallback(
33
35
  (event) => {
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import {
3
- __async
3
+ __async,
4
+ __spreadValues
4
5
  } from "../../chunk-MMUBH76A.js";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
@@ -38,6 +39,8 @@ function ExternalWalletProvider({ children }) {
38
39
  const solanaContext = useStore((state) => state.solanaContext);
39
40
  const externalWallets = useStore((state) => state.externalWallets);
40
41
  const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
42
+ const includeWalletVerification = useStore((state) => state.includeWalletVerification);
43
+ const connectionOnly = useStore((state) => state.connectionOnly);
41
44
  const {
42
45
  wallets: evmWallets,
43
46
  disconnect: evmDisconnect,
@@ -177,23 +180,34 @@ function ExternalWalletProvider({ children }) {
177
180
  [evmSwitchChain, cosmosSwitchChain]
178
181
  );
179
182
  const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
180
- var _a;
181
183
  setExternalWalletError();
182
184
  setIsExternalWalletVerifying(true);
183
- const walletType = (_a = Object.values(para.externalWallets)[0]) == null ? void 0 : _a.type;
185
+ const wallet2 = Object.values(para.externalWallets)[0];
186
+ const walletType = wallet2 == null ? void 0 : wallet2.type;
184
187
  let verifyExternalWalletParams;
188
+ const withVerification = includeWalletVerification;
189
+ const isConnectionOnly = connectionOnly;
190
+ const withFullParaAuth = (wallet2 == null ? void 0 : wallet2.name) ? externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase()) : false;
191
+ const defaultWalletInfo = {
192
+ withVerification,
193
+ isConnectionOnly,
194
+ withFullParaAuth,
195
+ provider: wallet2.name,
196
+ isExternal: true
197
+ };
185
198
  switch (walletType) {
186
199
  case "COSMOS":
187
200
  {
188
- const { address, signature, error, cosmosPublicKeyHex, cosmosSigner } = yield cosmosSignVerificationMessage();
201
+ const { address, signature, error, cosmosPublicKeyHex, cosmosSigner, addressBech32 } = yield cosmosSignVerificationMessage();
189
202
  if (error) {
190
203
  setExternalWalletError([error]);
191
204
  } else if (signature && address) {
192
205
  verifyExternalWalletParams = {
193
- externalWallet: {
206
+ externalWallet: __spreadValues({
194
207
  type: "COSMOS",
195
- address
196
- },
208
+ address,
209
+ addressBech32
210
+ }, defaultWalletInfo),
197
211
  signedMessage: signature,
198
212
  cosmosPublicKeyHex,
199
213
  cosmosSigner
@@ -208,10 +222,10 @@ function ExternalWalletProvider({ children }) {
208
222
  setExternalWalletError([error]);
209
223
  } else if (signature && address) {
210
224
  verifyExternalWalletParams = {
211
- externalWallet: {
225
+ externalWallet: __spreadValues({
212
226
  type: "EVM",
213
227
  address
214
- },
228
+ }, defaultWalletInfo),
215
229
  signedMessage: signature
216
230
  };
217
231
  }
@@ -224,10 +238,10 @@ function ExternalWalletProvider({ children }) {
224
238
  setExternalWalletError([error]);
225
239
  } else if (signature && address) {
226
240
  verifyExternalWalletParams = {
227
- externalWallet: {
241
+ externalWallet: __spreadValues({
228
242
  type: "SOLANA",
229
243
  address
230
- },
244
+ }, defaultWalletInfo),
231
245
  signedMessage: signature
232
246
  };
233
247
  }
@@ -242,7 +256,14 @@ function ExternalWalletProvider({ children }) {
242
256
  return;
243
257
  }
244
258
  verifyExternalWallet(verifyExternalWalletParams, {
245
- onSuccess: onNewAuthState,
259
+ onSuccess: (d) => {
260
+ var _a;
261
+ if (wallet2 && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes((_a = wallet2.name) == null ? void 0 : _a.toUpperCase()))) {
262
+ onNewAuthState(d);
263
+ } else {
264
+ setStep(ModalStep.LOGIN_DONE);
265
+ }
266
+ },
246
267
  onError: (e) => {
247
268
  console.error("Error verifying signature:", e);
248
269
  setExternalWalletError(["Signature verification failed."]);
@@ -255,7 +276,7 @@ function ExternalWalletProvider({ children }) {
255
276
  }
256
277
  setIsExternalWalletVerifying(false);
257
278
  return void 0;
258
- }), [cosmosSignVerificationMessage, evmSignVerificationMessage, solanaSignVerificationMessage]);
279
+ }), [cosmosSignVerificationMessage, evmSignVerificationMessage, solanaSignVerificationMessage, wallet]);
259
280
  const connectExternalWallet = useCallback(
260
281
  (wallet2, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __async(this, null, function* () {
261
282
  if (isExternalWalletConnecting && isManualWalletConnect) {
@@ -269,7 +290,7 @@ function ExternalWalletProvider({ children }) {
269
290
  setExternalWalletError();
270
291
  setIsExternalWalletConnecting(true);
271
292
  setIsUsingMobileConnector(isMobileConnect);
272
- const { address, error, authState } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect) : wallet2.connect();
293
+ const { address, error, authState } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect, connectionOnly) : wallet2.connect(connectionOnly);
273
294
  if (error) {
274
295
  setExternalWalletError([error]);
275
296
  setIsUsingMobileConnector();
@@ -280,7 +301,7 @@ function ExternalWalletProvider({ children }) {
280
301
  return;
281
302
  }
282
303
  } else if (address) {
283
- if (!!authState && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes(wallet2.id.toUpperCase()))) {
304
+ if (!!authState && ((externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase())) || includeWalletVerification)) {
284
305
  onNewAuthState(authState);
285
306
  } else {
286
307
  setStep(ModalStep.LOGIN_DONE);
@@ -289,7 +310,7 @@ function ExternalWalletProvider({ children }) {
289
310
  setIsExternalWalletConnecting(false);
290
311
  }
291
312
  }),
292
- [isExternalWalletConnecting, externalWalletsWithFullAuth]
313
+ [isExternalWalletConnecting, externalWalletsWithFullAuth, connectionOnly, includeWalletVerification]
293
314
  );
294
315
  const disconnectExternalWallet = () => __async(this, null, function* () {
295
316
  yield para.logout();
@@ -9,6 +9,10 @@ const createExternalWalletsSlice = (set) => ({
9
9
  setExternalWallets: (externalWallets) => set({ externalWallets }),
10
10
  externalWalletsWithFullAuth: [],
11
11
  setExternalWalletsWithFullAuth: (externalWalletsWithFullAuth) => set({ externalWalletsWithFullAuth }),
12
+ includeWalletVerification: false,
13
+ setIncludeWalletVerification: (includeWalletVerification) => set({ includeWalletVerification }),
14
+ connectionOnly: false,
15
+ setConnectionOnly: (connectionOnly) => set({ connectionOnly }),
12
16
  evmContext: EvmExternalWalletContext,
13
17
  setEvmContext: (evmContext) => set({ evmContext }),
14
18
  EvmProvider: void 0,
@@ -37,6 +37,10 @@ export interface WalletSlice {
37
37
  export interface ExternalWalletsSlice {
38
38
  externalWallets: TExternalWallet[];
39
39
  setExternalWallets: (_: TExternalWallet[]) => void;
40
+ connectionOnly: boolean;
41
+ setConnectionOnly: (_: boolean) => void;
42
+ includeWalletVerification: boolean;
43
+ setIncludeWalletVerification: (_: boolean) => void;
40
44
  externalWalletsWithFullAuth: TExternalWallet[];
41
45
  setExternalWalletsWithFullAuth: (_: TExternalWallet[]) => void;
42
46
  evmContext: Context<EvmExternalWalletContextType>;
@@ -107,11 +107,23 @@ export type ExternalWalletConfig<chains extends readonly [Chain, ...Chain[]], tr
107
107
  */
108
108
  wallets?: TExternalWallet[];
109
109
  /**
110
- * Array of external wallets that will also include linked embedded wallets.
110
+ * Array of external wallets that will also include linked embedded wallets. Also includes a wallet verification step.
111
111
  *
112
112
  * You can also pass `ALL` to include linked embedded wallets for all external wallets.
113
113
  */
114
114
  createLinkedEmbeddedForExternalWallets?: TExternalWallet[] | 'ALL';
115
+ /**
116
+ * Whether or not to validate a signature from the connected external wallet and create a Para session.
117
+ *
118
+ * All wallets using createLinkedEmbeddedForExternalWallets automatically include wallet verification.
119
+ */
120
+ includeWalletVerification?: boolean;
121
+ /**
122
+ * Whether or not to treat external wallets as connections only, skipping all Para functionality.
123
+ *
124
+ * This prop will override the createLinkedEmbeddedForExternalWallets and includeWalletVerification props
125
+ */
126
+ connectionOnly?: boolean;
115
127
  };
116
128
  export interface ParaProviderProps<chains extends readonly [Chain, ...Chain[]], transports extends Record<chains[number]['id'], Transport>> extends PropsWithChildren {
117
129
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk",
3
- "version": "2.0.0-alpha.15",
3
+ "version": "2.0.0-alpha.17",
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.15",
19
- "@getpara/react-components": "2.0.0-alpha.15",
20
- "@getpara/web-sdk": "2.0.0-alpha.15",
18
+ "@getpara/react-common": "2.0.0-alpha.17",
19
+ "@getpara/react-components": "2.0.0-alpha.17",
20
+ "@getpara/web-sdk": "2.0.0-alpha.17",
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.15",
37
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.15",
38
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.15",
36
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.17",
37
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.17",
38
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.17",
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": "f837a1584f2a0b5d61c9b7a91cd74a68c01d5161"
66
+ "gitHead": "5cb0f3dee5564995c465ead160ed817ba2ba37a7"
67
67
  }
@@ -1,16 +0,0 @@
1
- import { OnrampSessionResult } from '@stripe/crypto';
2
- export declare const STRIPE_PUBLISHABLE_KEY = "pk_live_51MvquNGrzDeP5yP9EgVSMBPQbrbg0oHDjPIIXypePd0jzOFjbadyfO7wBKLHhUtbKIUiEUVC3YYcTJyAmJ8xA7JE00T2UDfYKz";
3
- export declare const STRIPE_PUBLISHABLE_KEY_TEST = "pk_test_51MvquNGrzDeP5yP98WgPaAUgQ50I3OpfPhVfiLO47FBHepJnZRPO62IzZY2uxT5ovhSS10RwcTcnaVil1mcJOzIi00dHapODdS";
4
- export declare const CryptoElements: ({ stripeOnramp, children }: {
5
- stripeOnramp: any;
6
- children: any;
7
- }) => import("react/jsx-runtime").JSX.Element;
8
- export declare const useStripeOnramp: () => any;
9
- export declare const OnrampElement: ({ clientSecret, appearance, onReady, onSessionChange, ...props }: {
10
- clientSecret: string;
11
- appearance: "dark" | "light";
12
- onReady?: () => void;
13
- onSessionChange: (_: {
14
- session: OnrampSessionResult;
15
- }) => void;
16
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,88 +0,0 @@
1
- "use client";
2
- import {
3
- __objRest,
4
- __spreadProps,
5
- __spreadValues
6
- } from "../../../chunk-MMUBH76A.js";
7
- import { jsx } from "react/jsx-runtime";
8
- import React from "react";
9
- const STRIPE_PUBLISHABLE_KEY = "pk_live_51MvquNGrzDeP5yP9EgVSMBPQbrbg0oHDjPIIXypePd0jzOFjbadyfO7wBKLHhUtbKIUiEUVC3YYcTJyAmJ8xA7JE00T2UDfYKz";
10
- const STRIPE_PUBLISHABLE_KEY_TEST = "pk_test_51MvquNGrzDeP5yP98WgPaAUgQ50I3OpfPhVfiLO47FBHepJnZRPO62IzZY2uxT5ovhSS10RwcTcnaVil1mcJOzIi00dHapODdS";
11
- const CryptoElementsContext = React.createContext({ onramp: null });
12
- CryptoElementsContext.displayName = "CryptoElementsContext";
13
- const CryptoElements = ({ stripeOnramp, children }) => {
14
- const [ctx, setContext] = React.useState(() => ({
15
- onramp: null
16
- }));
17
- React.useEffect(() => {
18
- let isMounted = true;
19
- Promise.resolve(stripeOnramp).then((onramp) => {
20
- if (onramp && isMounted) {
21
- setContext((ctx2) => ctx2.onramp ? ctx2 : { onramp });
22
- }
23
- });
24
- return () => {
25
- isMounted = false;
26
- };
27
- }, [stripeOnramp]);
28
- return /* @__PURE__ */ jsx(CryptoElementsContext.Provider, { value: ctx, children });
29
- };
30
- const useStripeOnramp = () => {
31
- const context = React.useContext(CryptoElementsContext);
32
- return context == null ? void 0 : context.onramp;
33
- };
34
- const useOnrampSessionListener = (type, session, callback) => {
35
- React.useEffect(() => {
36
- if (session && callback) {
37
- const listener = (e) => callback(e.payload);
38
- session.addEventListener(type, listener);
39
- return () => {
40
- session.removeEventListener(type, listener);
41
- };
42
- }
43
- return () => {
44
- };
45
- }, [session, callback, type]);
46
- };
47
- const OnrampElement = (_a) => {
48
- var _b = _a, {
49
- clientSecret,
50
- appearance,
51
- onReady = () => {
52
- },
53
- onSessionChange
54
- } = _b, props = __objRest(_b, [
55
- "clientSecret",
56
- "appearance",
57
- "onReady",
58
- "onSessionChange"
59
- ]);
60
- const stripeOnramp = useStripeOnramp();
61
- const onrampElementRef = React.useRef(null);
62
- const [session, setSession] = React.useState();
63
- const appearanceJSON = JSON.stringify(appearance);
64
- React.useEffect(() => {
65
- const containerRef = onrampElementRef.current;
66
- if (containerRef) {
67
- containerRef.innerHTML = "";
68
- if (clientSecret && stripeOnramp) {
69
- setSession(
70
- stripeOnramp.createSession({
71
- clientSecret,
72
- appearance: { theme: appearance }
73
- }).mount(containerRef)
74
- );
75
- }
76
- }
77
- }, [appearanceJSON, clientSecret, stripeOnramp]);
78
- useOnrampSessionListener("onramp_ui_loaded", session, onReady);
79
- useOnrampSessionListener("onramp_session_updated", session, onSessionChange);
80
- return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, props), { ref: onrampElementRef }));
81
- };
82
- export {
83
- CryptoElements,
84
- OnrampElement,
85
- STRIPE_PUBLISHABLE_KEY,
86
- STRIPE_PUBLISHABLE_KEY_TEST,
87
- useStripeOnramp
88
- };