@getpara/react-sdk 2.0.0-alpha.27 → 2.0.0-alpha.29

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.
Files changed (33) hide show
  1. package/dist/modal/ParaModal.js +6 -6
  2. package/dist/modal/components/Account/Account.js +2 -2
  3. package/dist/modal/components/Account/AccountProfile.js +7 -8
  4. package/dist/modal/components/AddFunds/AddFunds.js +2 -2
  5. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +2 -2
  6. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +2 -2
  7. package/dist/modal/components/Controls/Controls.js +2 -2
  8. package/dist/modal/components/Controls/Selects.js +2 -2
  9. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +2 -2
  10. package/dist/modal/components/Footer/Footer.js +3 -3
  11. package/dist/modal/constants/constants.d.ts +1 -1
  12. package/dist/modal/constants/constants.js +1 -1
  13. package/dist/provider/actions/{getAccount.d.ts → getEmbeddedAccount.d.ts} +3 -3
  14. package/dist/provider/actions/{getAccount.js → getEmbeddedAccount.js} +11 -13
  15. package/dist/provider/external/getParaCosmosConnector.js +4 -7
  16. package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
  17. package/dist/provider/external/getParaCosmosLib.js +16 -0
  18. package/dist/provider/external/getParaEvmConnector.js +4 -7
  19. package/dist/provider/external/getParaEvmLib.d.ts +4 -0
  20. package/dist/provider/external/getParaEvmLib.js +16 -0
  21. package/dist/provider/external/getParaSolanaConnector.js +4 -7
  22. package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
  23. package/dist/provider/external/getParaSolanaLib.js +16 -0
  24. package/dist/provider/hooks/queries/useAccount.d.ts +87 -2
  25. package/dist/provider/hooks/queries/useAccount.js +117 -7
  26. package/dist/provider/hooks/queries/useWalletBalance.js +3 -3
  27. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +3 -3
  28. package/dist/provider/providers/AccountLinkProvider.js +5 -4
  29. package/dist/provider/providers/ExternalWalletProvider.d.ts +0 -2
  30. package/dist/provider/providers/ExternalWalletProvider.js +15 -25
  31. package/dist/provider/stores/slices/externalWallets.js +2 -0
  32. package/dist/provider/stores/types.d.ts +3 -0
  33. package/package.json +8 -8
@@ -48,7 +48,7 @@ const ParaModal = forwardRef((props, ref) => {
48
48
  const { setSelectedWallet, updateSelectedWallet } = useWalletState();
49
49
  const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
50
50
  const { signUpOrLogIn, isCreateGuestWalletsPending } = useAuthActions();
51
- const { data: account, status: statusAccount } = useAccount();
51
+ const { isLoading: isAccountLoading, isConnected } = useAccount();
52
52
  const [isModalMounted, setIsModalMounted] = useState(false);
53
53
  const externalWallets = useStore((state) => state.externalWallets);
54
54
  const providerProps = useStore((state) => state.providerProps);
@@ -133,7 +133,7 @@ const ParaModal = forwardRef((props, ref) => {
133
133
  }, [hasPreviousStep, currentStep]);
134
134
  const initModal = (shouldAutoLogin) => __async(void 0, null, function* () {
135
135
  var _a2;
136
- const isAccount = account == null ? void 0 : account.isConnected, isGuest = isAccount && para.isGuestMode || isCreateGuestWalletsPending;
136
+ const isAccount = isConnected, isGuest = isAccount && para.isGuestMode || isCreateGuestWalletsPending;
137
137
  switch (true) {
138
138
  case !!currentStepOverride:
139
139
  setStep(ModalStep[currentStepOverride.toUpperCase()]);
@@ -177,7 +177,7 @@ const ParaModal = forwardRef((props, ref) => {
177
177
  }
178
178
  });
179
179
  useEffect(() => {
180
- if (para && isOpen && statusAccount === "success" && !isInitialized.current) {
180
+ if (para && isOpen && !isAccountLoading && !isInitialized.current) {
181
181
  initModal(isOpen);
182
182
  isInitialized.current = true;
183
183
  }
@@ -185,7 +185,7 @@ const ParaModal = forwardRef((props, ref) => {
185
185
  initModal();
186
186
  isInitialized.current = false;
187
187
  }
188
- }, [para, isOpen, account, statusAccount]);
188
+ }, [para, isOpen, isAccountLoading]);
189
189
  useEffect(() => {
190
190
  let _authLayout = authLayout;
191
191
  if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
@@ -210,10 +210,10 @@ const ParaModal = forwardRef((props, ref) => {
210
210
  updateSelectedWallet();
211
211
  }, [para]);
212
212
  useEffect(() => {
213
- if (bareModal && account && !account.isConnected && !["signup", "login"].includes(flow != null ? flow : "") && refs.currentStep.current !== ModalStep.AUTH_MAIN) {
213
+ if (bareModal && !isAccountLoading && !isConnected && !["signup", "login"].includes(flow != null ? flow : "") && refs.currentStep.current !== ModalStep.AUTH_MAIN) {
214
214
  setStep(ModalStep.AUTH_MAIN);
215
215
  }
216
- }, [bareModal, flow, account]);
216
+ }, [bareModal, flow, isConnected, isAccountLoading]);
217
217
  useEffect(() => {
218
218
  setAccountLinkOptions(propsSupportedAccountLinks != null ? propsSupportedAccountLinks : para == null ? void 0 : para.supportedAccountLinks);
219
219
  }, [propsSupportedAccountLinks, para == null ? void 0 : para.supportedAccountLinks]);
@@ -28,11 +28,11 @@ const Account = ({ onClose }) => {
28
28
  });
29
29
  const { disconnectExternalWallet } = useExternalWallets();
30
30
  const para = useInternalClient();
31
- const { data: account } = useAccount();
31
+ const { embedded } = useAccount();
32
32
  const { data: balance, isLoading: isBalanceLoading } = useWalletBalance();
33
33
  const { isEnabled } = useAccountLinking();
34
34
  const [isDisconnecting, setIsDisconnecting] = useState(false);
35
- const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
35
+ const isGuestMode = embedded.isConnected && embedded.isGuestMode;
36
36
  const cantBuyAndWithdraw = (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") && !para.userId;
37
37
  const isOnRampLoaded = !!onRampConfig;
38
38
  const handleBuyClick = () => {
@@ -6,7 +6,7 @@ import {
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { AccountTypeIcon, GradientScroll, StepContainer } from "../common.js";
8
8
  import { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
9
- import { useAccount, useClient } from "../../../provider/index.js";
9
+ import { useClient } from "../../../provider/index.js";
10
10
  import { useLinkedAccounts } from "../../../provider/hooks/index.js";
11
11
  import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
12
12
  import { truncateAddress } from "@getpara/web-sdk";
@@ -45,15 +45,14 @@ const Entry = ({
45
45
  ] }, address != null ? address : identifier);
46
46
  };
47
47
  const AccountProfile = () => {
48
- var _a, _b, _c, _d, _e;
48
+ var _a, _b, _c, _d, _e, _f;
49
49
  const para = useClient();
50
- const { data: account } = useAccount();
51
50
  const { data: linkedAccounts } = useLinkedAccounts();
52
51
  const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
53
52
  if (!para) {
54
53
  return null;
55
54
  }
56
- const externalWallet = account == null ? void 0 : account.externalWallet;
55
+ const externalWallet = (_a = para.authInfo) == null ? void 0 : _a.externalWallet;
57
56
  return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
58
57
  /* @__PURE__ */ jsxs(Section, { children: [
59
58
  /* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Connected Wallets" }),
@@ -61,14 +60,14 @@ const AccountProfile = () => {
61
60
  Entry,
62
61
  {
63
62
  icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: externalWallet.providerId, size: "24px" }),
64
- name: (_b = (_a = externalWallet.ensName) != null ? _a : getAccountTypeName(externalWallet.providerId)) != null ? _b : "",
65
- address: (_c = externalWallet.addressBech32) != null ? _c : externalWallet.address,
66
- addressShort: truncateAddress((_d = externalWallet.addressBech32) != null ? _d : externalWallet.address, externalWallet.type, {
63
+ name: (_c = (_b = externalWallet.ensName) != null ? _b : getAccountTypeName(externalWallet.providerId)) != null ? _c : "",
64
+ address: (_d = externalWallet.addressBech32) != null ? _d : externalWallet.address,
65
+ addressShort: truncateAddress((_e = externalWallet.addressBech32) != null ? _e : externalWallet.address, externalWallet.type, {
67
66
  prefix: para.cosmosPrefix
68
67
  })
69
68
  },
70
69
  externalWallet.address
71
- ) : (_e = account == null ? void 0 : account.wallets) == null ? void 0 : _e.map((wallet) => {
70
+ ) : (_f = para == null ? void 0 : para.availableWallets) == null ? void 0 : _f.map((wallet) => {
72
71
  var _a2;
73
72
  return /* @__PURE__ */ jsx(
74
73
  Entry,
@@ -22,8 +22,8 @@ const AddFunds = () => {
22
22
  const setModalStep = useModalStore((state) => state.setStep);
23
23
  const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
24
24
  const { data: activeWallet } = useWallet();
25
- const { data: account } = useAccount();
26
- const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
25
+ const { embedded } = useAccount();
26
+ const isGuestMode = (embedded == null ? void 0 : embedded.isConnected) && embedded.isGuestMode;
27
27
  const tabs = TABS.filter(
28
28
  ([enabledFlow, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (!isGuestMode || enabledFlow === EnabledFlow.RECEIVE)
29
29
  );
@@ -22,7 +22,7 @@ const AuthMainStepContent = ({
22
22
  }) => {
23
23
  const { wallets } = useExternalWallets();
24
24
  const { createGuestWallets } = useAuthActions();
25
- const { data: account } = useAccount();
25
+ const { embedded } = useAccount();
26
26
  const authLayout = useModalStore((state) => state.authLayout);
27
27
  const setStep = useModalStore((state) => state.setStep);
28
28
  const oAuthLogoVariant = useStore((state) => state.oAuthLogoVariant);
@@ -30,7 +30,7 @@ const AuthMainStepContent = ({
30
30
  var _a, _b;
31
31
  return ((_b = (_a = state.modalConfig) == null ? void 0 : _a.theme) == null ? void 0 : _b.mode) === "dark";
32
32
  });
33
- const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
33
+ const isGuestMode = (embedded == null ? void 0 : embedded.isConnected) && embedded.isGuestMode;
34
34
  const useBrandedLogos = oAuthLogoVariant === "default";
35
35
  const useDarkLogos = useBrandedLogos ? isDark : oAuthLogoVariant !== "dark";
36
36
  const handleCondensedAuthClick = () => {
@@ -14,7 +14,7 @@ const AwaitingWalletCreationStep = ({ isGuestMode = false }) => {
14
14
  });
15
15
  const [showInfoBox, setShowInfoBox] = useState(false);
16
16
  const showInfoBoxTimeout = useRef();
17
- const { data: account } = useAccount();
17
+ const { embedded } = useAccount();
18
18
  useEffect(() => {
19
19
  if (typeof window !== "undefined") {
20
20
  showInfoBoxTimeout.current = window.setTimeout(() => {
@@ -27,7 +27,7 @@ const AwaitingWalletCreationStep = ({ isGuestMode = false }) => {
27
27
  /* @__PURE__ */ jsx(
28
28
  Waiting,
29
29
  {
30
- heading: isGuestMode ? "Creating Guest Account" : (account == null ? void 0 : account.isGuestMode) ? hideWallets ? "Linking Guest Account" : "Linking Guest Wallet" : hideWallets ? "Creating Your Account" : "Creating Your Wallet",
30
+ heading: isGuestMode ? "Creating Guest Account" : (embedded == null ? void 0 : embedded.isGuestMode) ? hideWallets ? "Linking Guest Account" : "Linking Guest Wallet" : hideWallets ? "Creating Your Account" : "Creating Your Wallet",
31
31
  subheading: "This should only take a couple of seconds."
32
32
  }
33
33
  ),
@@ -18,7 +18,7 @@ const Controls = ({ onClose }) => {
18
18
  const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
19
19
  const step = useModalStore((state) => state.step);
20
20
  const goBack = useGoBack();
21
- const { data: account } = useAccount();
21
+ const { isConnected } = useAccount();
22
22
  const shouldShowSelects = [
23
23
  ModalStep.ACCOUNT_MAIN,
24
24
  ModalStep.CHAIN_SWITCH,
@@ -41,7 +41,7 @@ const Controls = ({ onClose }) => {
41
41
  children: /* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
42
42
  }
43
43
  ),
44
- /* @__PURE__ */ jsx(MiddleContainer, { children: shouldShowSelects && (account == null ? void 0 : account.isConnected) && /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ /* @__PURE__ */ jsx(MiddleContainer, { children: shouldShowSelects && isConnected && /* @__PURE__ */ jsxs(Fragment, { children: [
45
45
  /* @__PURE__ */ jsx(ChainSelect, {}),
46
46
  /* @__PURE__ */ jsx(AccountSelect, {})
47
47
  ] }) }),
@@ -73,8 +73,8 @@ const AccountSelect = () => {
73
73
  const [isCopied, copy] = useCopyToClipboard();
74
74
  const { setSelectedWallet } = useWalletState();
75
75
  const { data: activeWallet } = useWallet();
76
- const { data: account } = useAccount();
77
- const availableWallets = account == null ? void 0 : account.wallets;
76
+ const { embedded } = useAccount();
77
+ const availableWallets = embedded == null ? void 0 : embedded.wallets;
78
78
  const isGuest = para.isGuestMode && (activeWallet == null ? void 0 : activeWallet.pregenIdentifierType) === "GUEST_ID";
79
79
  const handleCopy = () => {
80
80
  copy((activeWallet == null ? void 0 : activeWallet.address) ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "");
@@ -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 { isExternalWalletVerifying, verifyWalletSignature } = useExternalWallets();
12
+ const { verifyWalletSignature } = useExternalWallets();
13
13
  const externalWalletError = useModalStore((state) => state.externalWalletError);
14
14
  useEffect(() => {
15
15
  const hasRun = effectRan.current;
@@ -27,7 +27,7 @@ const ExternalWalletVerificationStep = () => {
27
27
  /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: externalWalletError == null ? void 0 : externalWalletError[0] })
28
28
  ] })
29
29
  ] }),
30
- /* @__PURE__ */ jsx(InnerStepContainer, { children: isExternalWalletVerifying || !effectRan.current ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(CpslButton, { onClick: verifyWalletSignature, children: "Retry" }) })
30
+ /* @__PURE__ */ jsx(InnerStepContainer, { children: !externalWalletError || !effectRan.current ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(CpslButton, { onClick: verifyWalletSignature, children: "Retry" }) })
31
31
  ] });
32
32
  };
33
33
  const InlineText = safeStyled(CpslText)`
@@ -9,9 +9,9 @@ import { useMemo } from "react";
9
9
  import { getStepHasFooter } from "../../utils/steps.js";
10
10
  import { useAccount } from "../../../provider/index.js";
11
11
  const Footer = () => {
12
- const { data: account } = useAccount();
12
+ const { embedded } = useAccount();
13
13
  const currentStep = useModalStore((state) => state.step);
14
- const accountFooter = (account == null ? void 0 : account.isConnected) && !account.isGuestMode;
14
+ const accountFooter = (embedded == null ? void 0 : embedded.isConnected) && !embedded.isGuestMode;
15
15
  const showFooter = accountFooter || getStepHasFooter(currentStep);
16
16
  const Content = useMemo(() => {
17
17
  if (accountFooter) {
@@ -35,7 +35,7 @@ const Footer = () => {
35
35
  /* @__PURE__ */ jsx(ParaLogo, { icon: "para" })
36
36
  ] })
37
37
  ] });
38
- }, [account]);
38
+ }, [embedded]);
39
39
  if (!showFooter) {
40
40
  return null;
41
41
  }
@@ -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" | "walletConnect" | "wallet" | "close" | "copy" | "safe" | "cosmos" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solana" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "userPlus" | "user" | "valora" | "youtubeBrand" | "youtube" | "zerion" | "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" | "wallet" | "cosmos" | "solana" | "para" | "walletConnect" | "close" | "copy" | "safe" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "userPlus" | "user" | "valora" | "youtubeBrand" | "youtube" | "zerion" | "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.27";
122
+ const SDK_VERSION = "2.0.0-alpha.29";
123
123
  export {
124
124
  BODY_MOTION_VARIANTS,
125
125
  BODY_TRANSITION,
@@ -1,5 +1,5 @@
1
- import ParaWeb, { CoreAuthInfo } from '@getpara/web-sdk';
2
- type AccountValue = CoreAuthInfo & {
1
+ import ParaWeb, { PrimaryAuthInfo } from '@getpara/web-sdk';
2
+ type AccountValue = PrimaryAuthInfo & {
3
3
  email?: string;
4
4
  phone?: `+${number}`;
5
5
  farcasterUsername?: string;
@@ -22,5 +22,5 @@ export type Account = ({
22
22
  isConnected: true;
23
23
  isGuestMode: false;
24
24
  } & AccountValue);
25
- export declare const getAccount: (para?: ParaWeb, isConnected?: boolean) => Promise<Account>;
25
+ export declare const getEmbeddedAccount: (para?: ParaWeb, _isConnected?: boolean) => Promise<Account>;
26
26
  export {};
@@ -1,29 +1,27 @@
1
1
  "use client";
2
2
  import {
3
- __async,
4
- __spreadProps,
5
- __spreadValues
3
+ __async
6
4
  } from "../../chunk-MMUBH76A.js";
7
- const getAccount = (para, isConnected) => __async(void 0, null, function* () {
8
- if (!para) {
9
- return { isConnected: false };
10
- }
11
- if (para.isGuestMode) {
5
+ const getEmbeddedAccount = (para, _isConnected) => __async(void 0, null, function* () {
6
+ if (!!para && para.isGuestMode) {
12
7
  return {
13
8
  isConnected: true,
14
9
  isGuestMode: true,
15
10
  wallets: para.availableWallets
16
11
  };
17
12
  }
18
- const _isConnected = isConnected != null ? isConnected : yield para == null ? void 0 : para.isFullyLoggedIn();
19
- if (_isConnected) {
13
+ const isConnected = !!para && (_isConnected != null ? _isConnected : yield para == null ? void 0 : para.isFullyLoggedIn());
14
+ if (isConnected) {
20
15
  const authInfo = para.authInfo;
21
- const value = __spreadProps(__spreadValues({}, authInfo || {}), {
16
+ const value = {
17
+ auth: authInfo == null ? void 0 : authInfo.auth,
18
+ authType: authInfo == null ? void 0 : authInfo.authType,
19
+ identifier: authInfo == null ? void 0 : authInfo.identifier,
22
20
  userId: para.userId,
23
21
  wallets: para.availableWallets,
24
22
  isConnected: true,
25
23
  isGuestMode: false
26
- });
24
+ };
27
25
  if (authInfo) {
28
26
  switch (authInfo.authType) {
29
27
  case "email":
@@ -50,5 +48,5 @@ const getAccount = (para, isConnected) => __async(void 0, null, function* () {
50
48
  return { isConnected: false };
51
49
  });
52
50
  export {
53
- getAccount
51
+ getEmbeddedAccount
54
52
  };
@@ -3,17 +3,14 @@ import {
3
3
  __async
4
4
  } from "../../chunk-MMUBH76A.js";
5
5
  import { CosmosExternalWalletContext } from "./stubs/CosmosExternalWalletContextStub.js";
6
+ import { getParaCosmosLib } from "./getParaCosmosLib.js";
6
7
  const getParaCosmosConnector = () => __async(void 0, null, function* () {
7
- let Provider, context, wallets;
8
- try {
9
- const lib = yield import("@getpara/cosmos-wallet-connectors");
8
+ let Provider = void 0, context = CosmosExternalWalletContext, wallets = [];
9
+ const { lib } = yield getParaCosmosLib();
10
+ if (lib) {
10
11
  Provider = lib.ParaCosmosProvider;
11
12
  context = lib.CosmosExternalWalletContext;
12
13
  wallets = lib.allWallets;
13
- } catch (e) {
14
- Provider = void 0;
15
- context = CosmosExternalWalletContext;
16
- wallets = [];
17
14
  }
18
15
  return { Provider, context, wallets };
19
16
  });
@@ -0,0 +1,4 @@
1
+ import paraCosmosLib from '@getpara/cosmos-wallet-connectors';
2
+ export declare const getParaCosmosLib: () => Promise<{
3
+ lib: typeof paraCosmosLib | undefined;
4
+ }>;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ const getParaCosmosLib = () => __async(void 0, null, function* () {
6
+ let lib;
7
+ try {
8
+ lib = yield import("@getpara/cosmos-wallet-connectors");
9
+ } catch (e) {
10
+ lib = void 0;
11
+ }
12
+ return { lib };
13
+ });
14
+ export {
15
+ getParaCosmosLib
16
+ };
@@ -3,17 +3,14 @@ import {
3
3
  __async
4
4
  } from "../../chunk-MMUBH76A.js";
5
5
  import { EvmExternalWalletContext } from "./stubs/EvmExternalWalletContextStub.js";
6
+ import { getParaEvmLib } from "./getParaEvmLib.js";
6
7
  const getParaEvmConnector = () => __async(void 0, null, function* () {
7
- let Provider, context, wallets;
8
- try {
9
- const lib = yield import("@getpara/evm-wallet-connectors");
8
+ let Provider = void 0, context = EvmExternalWalletContext, wallets = [];
9
+ const { lib } = yield getParaEvmLib();
10
+ if (lib) {
10
11
  Provider = lib.ParaEvmProvider;
11
12
  context = lib.EvmExternalWalletContext;
12
13
  wallets = lib.allWallets;
13
- } catch (e) {
14
- Provider = void 0;
15
- context = EvmExternalWalletContext;
16
- wallets = [];
17
14
  }
18
15
  return { Provider, context, wallets };
19
16
  });
@@ -0,0 +1,4 @@
1
+ import paraEvmLib from '@getpara/evm-wallet-connectors';
2
+ export declare const getParaEvmLib: () => Promise<{
3
+ lib: typeof paraEvmLib | undefined;
4
+ }>;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ const getParaEvmLib = () => __async(void 0, null, function* () {
6
+ let lib;
7
+ try {
8
+ lib = yield import("@getpara/evm-wallet-connectors");
9
+ } catch (e) {
10
+ lib = void 0;
11
+ }
12
+ return { lib };
13
+ });
14
+ export {
15
+ getParaEvmLib
16
+ };
@@ -3,17 +3,14 @@ import {
3
3
  __async
4
4
  } from "../../chunk-MMUBH76A.js";
5
5
  import { SolanaExternalWalletContext } from "./stubs/SolanaExternalWalletContextStub.js";
6
+ import { getParaSolanaLib } from "./getParaSolanaLib.js";
6
7
  const getParaSolanaConnector = () => __async(void 0, null, function* () {
7
- let Provider, context, wallets;
8
- try {
9
- const lib = yield import("@getpara/solana-wallet-connectors");
8
+ let Provider = void 0, context = SolanaExternalWalletContext, wallets = [];
9
+ const { lib } = yield getParaSolanaLib();
10
+ if (lib) {
10
11
  Provider = lib.ParaSolanaProvider;
11
12
  context = lib.SolanaExternalWalletContext;
12
13
  wallets = lib.allWallets;
13
- } catch (e) {
14
- Provider = void 0;
15
- context = SolanaExternalWalletContext;
16
- wallets = [];
17
14
  }
18
15
  return { Provider, context, wallets };
19
16
  });
@@ -0,0 +1,4 @@
1
+ import paraSolanaLib from '@getpara/solana-wallet-connectors';
2
+ export declare const getParaSolanaLib: () => Promise<{
3
+ lib: typeof paraSolanaLib | undefined;
4
+ }>;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ const getParaSolanaLib = () => __async(void 0, null, function* () {
6
+ let lib;
7
+ try {
8
+ lib = yield import("@getpara/solana-wallet-connectors");
9
+ } catch (e) {
10
+ lib = void 0;
11
+ }
12
+ return { lib };
13
+ });
14
+ export {
15
+ getParaSolanaLib
16
+ };
@@ -1,5 +1,90 @@
1
+ import { useContext } from 'react';
2
+ import { Account } from '../../actions/getEmbeddedAccount.js';
3
+ import type { CosmosExternalWalletContextType, UseAccountParameters as UseCosmosAccountParameters } from '@getpara/cosmos-wallet-connectors';
4
+ import type { EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
5
+ import type { Adapter } from '@getpara/solana-wallet-connectors';
1
6
  export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
7
+ type EVMAccountType = ReturnType<ReturnType<typeof useContext<EvmExternalWalletContextType>>['useAccount']>;
8
+ type CosmosAccountType = Omit<ReturnType<ReturnType<typeof useContext<CosmosExternalWalletContextType>>['useAccount']>, 'reconnect'>;
9
+ type SolanaAccountType = Pick<Adapter, 'publicKey' | 'name' | 'icon' | 'readyState' | 'supportedTransactionVersions' | 'url'> & {
10
+ isConnected?: boolean;
11
+ isConnecting?: boolean;
12
+ };
13
+ type ConnectionType = 'embedded' | 'external' | 'both' | 'none';
14
+ type ExternalNetwork = 'evm' | 'cosmos' | 'solana';
2
15
  /**
3
- * Hook for retrieving a user account
16
+ * The return type for the useAccount hook.
17
+ *
18
+ * @property isConnected - Indicates whether there is a wallet connected (either embedded, external or both).
19
+ * @property isLoading - Indicates whether the account is currently loading.
20
+ * @property connectionType - The type of connection for the account:
21
+ * @property embedded - The embedded account object.
22
+ * @property external - An object containing connected external wallet account data:
23
+ * - `evm`: The connected EVM wallet account (if any).
24
+ * - `cosmos`: The connected Cosmos wallet account (if any), with the `reconnect` property omitted.
25
+ * - `solana`: The connected Solana wallet adapter, with only allowed properties included.
4
26
  */
5
- export declare const useAccount: () => import("@tanstack/react-query").UseQueryResult<import("../../actions/getAccount.js").Account, Error>;
27
+ export type UseAccountReturn = {
28
+ /**
29
+ * Indicates whether there is a wallet connected (either embedded, external or both).
30
+ */
31
+ isConnected: boolean;
32
+ /**
33
+ * Indicates whether the account is currently loading.
34
+ */
35
+ isLoading: boolean;
36
+ /**
37
+ * The type of connection for the account.
38
+ * - 'embedded': Only the embedded account is connected.
39
+ * - 'external': Only an external wallet is connected.
40
+ * - 'both': Both embedded and external wallets are connected.
41
+ * - 'none': No wallets are connected.
42
+ */
43
+ connectionType: ConnectionType;
44
+ /**
45
+ * The embedded account object. Use this instead of the deprecated top-level properties.
46
+ */
47
+ embedded: Omit<Account, 'isConnected' | 'isGuestMode'> & {
48
+ isConnected: boolean;
49
+ isGuestMode?: boolean;
50
+ };
51
+ /**
52
+ * Connected external wallet account data.
53
+ */
54
+ external: {
55
+ /**
56
+ * The list of connected external networks, which can include 'evm', 'cosmos', and 'solana'.
57
+ */
58
+ connectedNetworks: ExternalNetwork[];
59
+ /**
60
+ * The connected EVM wallet (if any), with only allowed properties included.
61
+ */
62
+ evm: EVMAccountType;
63
+ /**
64
+ * The connected Cosmos wallet (if any), with only allowed properties included.
65
+ */
66
+ cosmos: CosmosAccountType;
67
+ /**
68
+ * The connected Solana wallet (if any), with only allowed properties included.
69
+ */
70
+ solana: SolanaAccountType;
71
+ };
72
+ };
73
+ export type UseAccountParameters = {
74
+ cosmos?: UseCosmosAccountParameters;
75
+ };
76
+ /**
77
+ * React Query hook for retrieving the current embedded account and connected external wallets.
78
+ *
79
+ * @returns {UseAccountReturn}
80
+ * The account data object, or undefined while loading.
81
+ *
82
+ * The returned object contains:
83
+ * - `isConnected`: Indicates whether there is a wallet connected (either embedded, external or both).
84
+ * - `isLoading`: Indicates whether the account is currently loading.
85
+ * - `connectionType`: The type of connection for the account:
86
+ * - `embedded`: The embedded account object.
87
+ * - `external`: Connected external wallet data (EVM, Cosmos, Solana).
88
+ */
89
+ export declare const useAccount: ({ cosmos }?: UseAccountParameters) => UseAccountReturn;
90
+ export {};
@@ -1,23 +1,133 @@
1
1
  "use client";
2
2
  import {
3
- __async
3
+ __async,
4
+ __objRest,
5
+ __spreadProps,
6
+ __spreadValues
4
7
  } from "../../../chunk-MMUBH76A.js";
5
8
  import { useQuery } from "@tanstack/react-query";
6
- import { getAccount } from "../../actions/getAccount.js";
7
9
  import { useInternalClient } from "../utils/useInternalClient.js";
8
10
  import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
11
+ import { useStore } from "../../stores/useStore.js";
12
+ import { useContext } from "react";
13
+ import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
9
14
  const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
10
- const useAccount = () => {
11
- var _a, _b;
15
+ function pickSolanaAdapter(adapter) {
16
+ if (!adapter) return { isConnected: false };
17
+ const { connected, connecting, publicKey, name, icon, readyState, supportedTransactionVersions, url } = adapter;
18
+ return {
19
+ isConnected: connected,
20
+ isConnecting: connecting,
21
+ publicKey,
22
+ name,
23
+ icon,
24
+ readyState,
25
+ supportedTransactionVersions,
26
+ url
27
+ };
28
+ }
29
+ function pickCosmosAccount(account) {
30
+ if (!account) return { isConnected: false };
31
+ const _a = account, { reconnect: _ } = _a, rest = __objRest(_a, ["reconnect"]);
32
+ return rest;
33
+ }
34
+ const useAccount = ({ cosmos } = {}) => {
35
+ var _a, _b, _c, _d, _e, _f, _g;
12
36
  const client = useInternalClient();
13
37
  const { data: isFullyLoggedIn, isSuccess } = useIsFullyLoggedIn();
14
- return useQuery({
38
+ const evmContext = useStore((state) => state.evmContext);
39
+ const { useAccount: useEvmAccount } = useContext(evmContext);
40
+ const evmAccount = useEvmAccount();
41
+ const evmQueryKeys = [evmAccount == null ? void 0 : evmAccount.status, evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId];
42
+ const cosmosContext = useStore((state) => state.cosmosContext);
43
+ const { useAccount: useCosmosAccount } = useContext(cosmosContext);
44
+ const cosmosAccount = useCosmosAccount(cosmos);
45
+ const cosmosQueryKeys = [cosmosAccount == null ? void 0 : cosmosAccount.status, cosmosAccount == null ? void 0 : cosmosAccount.data];
46
+ const solanaContext = useStore((state) => state.solanaContext);
47
+ const { useWallet: useSolanaWallet } = useContext(solanaContext);
48
+ const solanaWallet = useSolanaWallet();
49
+ const solanaQueryKeys = [
50
+ (_b = (_a = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a.adapter) == null ? void 0 : _b.connected,
51
+ (_d = (_c = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _c.adapter) == null ? void 0 : _d.connecting,
52
+ (_f = (_e = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _e.adapter) == null ? void 0 : _f.publicKey
53
+ ];
54
+ const solanaAdapter = (_g = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _g.adapter;
55
+ const { data, isLoading } = useQuery({
15
56
  enabled: isSuccess && !!client,
16
- queryKey: [ACCOUNT_BASE_KEY, isFullyLoggedIn != null ? isFullyLoggedIn : null, (_a = client == null ? void 0 : client.userId) != null ? _a : null, (_b = client == null ? void 0 : client.isGuestMode) != null ? _b : null],
57
+ queryKey: [ACCOUNT_BASE_KEY, isFullyLoggedIn != null ? isFullyLoggedIn : null, client == null ? void 0 : client.userId, evmQueryKeys, cosmosQueryKeys, solanaQueryKeys],
17
58
  queryFn: () => __async(void 0, null, function* () {
18
- return yield getAccount(client, isFullyLoggedIn);
59
+ const paraAccount = yield getEmbeddedAccount(client);
60
+ let connectionType = "none";
61
+ if (paraAccount.isConnected) {
62
+ connectionType = "embedded";
63
+ if (paraAccount.wallets.some((w) => w.isExternal)) {
64
+ connectionType = "both";
65
+ }
66
+ if (paraAccount.wallets.every((w) => w.isExternal) && ((evmAccount == null ? void 0 : evmAccount.isConnected) || (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) || (solanaAdapter == null ? void 0 : solanaAdapter.connected))) {
67
+ connectionType = "external";
68
+ }
69
+ }
70
+ const isEmbeddedConnected = paraAccount.isConnected && (!!paraAccount.userId || paraAccount.isGuestMode);
71
+ const connectedNetworks = [];
72
+ if (evmAccount == null ? void 0 : evmAccount.isConnected) {
73
+ connectedNetworks.push("evm");
74
+ }
75
+ if (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) {
76
+ connectedNetworks.push("cosmos");
77
+ }
78
+ if (solanaAdapter == null ? void 0 : solanaAdapter.connected) {
79
+ connectedNetworks.push("solana");
80
+ }
81
+ return {
82
+ isConnected: paraAccount.isConnected,
83
+ connectionType,
84
+ embedded: __spreadProps(__spreadValues({}, paraAccount), { isConnected: isEmbeddedConnected }),
85
+ external: {
86
+ connectedNetworks,
87
+ evm: evmAccount != null ? evmAccount : {
88
+ address: void 0,
89
+ addresses: void 0,
90
+ chain: void 0,
91
+ chainId: void 0,
92
+ connector: void 0,
93
+ isConnected: false,
94
+ isReconnecting: false,
95
+ isConnecting: false,
96
+ isDisconnected: true,
97
+ status: "disconnected"
98
+ },
99
+ cosmos: pickCosmosAccount(cosmosAccount),
100
+ solana: pickSolanaAdapter(solanaAdapter)
101
+ }
102
+ };
19
103
  })
20
104
  });
105
+ const defaultResp = {
106
+ isConnected: false,
107
+ connectionType: "none",
108
+ isLoading,
109
+ embedded: {
110
+ isConnected: false
111
+ },
112
+ external: {
113
+ connectedNetworks: [],
114
+ evm: {
115
+ address: void 0,
116
+ addresses: void 0,
117
+ chain: void 0,
118
+ chainId: void 0,
119
+ connector: void 0,
120
+ isConnected: false,
121
+ isReconnecting: false,
122
+ isConnecting: false,
123
+ isDisconnected: true,
124
+ status: "disconnected"
125
+ },
126
+ cosmos: { isConnected: false },
127
+ solana: { isConnected: false }
128
+ }
129
+ };
130
+ return __spreadProps(__spreadValues({}, data != null ? data : defaultResp), { isLoading });
21
131
  };
22
132
  export {
23
133
  ACCOUNT_BASE_KEY,
@@ -16,7 +16,7 @@ const useWalletBalance = (args) => {
16
16
  const {
17
17
  selectedWallet: { type: selectedWalletType }
18
18
  } = useWalletState();
19
- const { data: account } = useAccount();
19
+ const { embedded } = useAccount();
20
20
  const rpcUrl = useStore((state) => state.rpcUrl);
21
21
  const { getWalletBalance: getExternalWalletBalance, chainId } = useExternalWallets();
22
22
  const queryFn = useCallback(() => __async(void 0, null, function* () {
@@ -36,7 +36,7 @@ const useWalletBalance = (args) => {
36
36
  console.error("Error fetching wallet balance: ", err);
37
37
  return null;
38
38
  }
39
- }), [account, selectedWallet, selectedWalletType, rpcUrl, getExternalWalletBalance]);
39
+ }), [embedded, selectedWallet, selectedWalletType, rpcUrl, getExternalWalletBalance]);
40
40
  return useQuery({
41
41
  queryKey: [
42
42
  WALLET_BALANCE_BASE_KEY,
@@ -46,7 +46,7 @@ const useWalletBalance = (args) => {
46
46
  (selectedWallet == null ? void 0 : selectedWallet.isExternal) ? chainId : ""
47
47
  ],
48
48
  queryFn,
49
- enabled: !!client && !!selectedWallet && !!rpcUrl && !!(account == null ? void 0 : account.isConnected)
49
+ enabled: !!client && !!selectedWallet && !!rpcUrl && !!(embedded == null ? void 0 : embedded.isConnected)
50
50
  });
51
51
  };
52
52
  export {
@@ -9,7 +9,7 @@ const SESSION_CHECK_INTERVAL = 6e4;
9
9
  const SESSION_REFRESH_THRESHOLD = 3e5;
10
10
  const useAutoSessionKeepAlive = ({ disabled }) => {
11
11
  const client = useInternalClient();
12
- const { data: account } = useAccount();
12
+ const { embedded } = useAccount();
13
13
  const { logoutAsync } = useLogout();
14
14
  const { keepSessionAliveAsync } = useKeepSessionAlive();
15
15
  const sessionCheckInterval = useRef(null);
@@ -18,13 +18,13 @@ const useAutoSessionKeepAlive = ({ disabled }) => {
18
18
  clearSessionMonitoring();
19
19
  return;
20
20
  }
21
- if ((account == null ? void 0 : account.isConnected) && !account.isGuestMode && client.externalWalletConnectionType !== "CONNECTION_ONLY") {
21
+ if ((embedded == null ? void 0 : embedded.isConnected) && !embedded.isGuestMode && client.externalWalletConnectionType !== "CONNECTION_ONLY") {
22
22
  setupSessionMonitoring();
23
23
  } else {
24
24
  clearSessionMonitoring();
25
25
  }
26
26
  return () => clearSessionMonitoring();
27
- }, [client, account, disabled]);
27
+ }, [client, embedded, disabled]);
28
28
  const getSessionExpiry = () => __async(void 0, null, function* () {
29
29
  try {
30
30
  const sessionCookie = yield client == null ? void 0 : client.retrieveSessionCookie();
@@ -66,9 +66,10 @@ const useVerifyFarcasterLink = generateInternalMutation("verifyFarcasterLink", a
66
66
  const useVerifyTelegramLink = generateInternalMutation("verifyTelegramLink", actions.verifyTelegramLink);
67
67
  const useVerifyExternalWalletLink = generateInternalMutation("verifyExternalWalletLink", actions.verifyExternalWalletLink);
68
68
  const AccountLinkProvider = ({ children }) => {
69
+ var _a;
69
70
  const para = useInternalClient();
70
71
  const queryClient = useQueryClient();
71
- const { data: account } = useAccount();
72
+ const { embedded } = useAccount();
72
73
  const { data: coreAccountLinkInProgress } = useAccountLinkInProgress();
73
74
  const {
74
75
  wallet: connectedWallet,
@@ -110,7 +111,7 @@ const AccountLinkProvider = ({ children }) => {
110
111
  status: statusVerifyExternalWalletLink,
111
112
  reset: resetVerifyExternalWalletLink
112
113
  } = useVerifyExternalWalletLink();
113
- const isEnabled = !!(account == null ? void 0 : account.isConnected) && !(account == null ? void 0 : account.isGuestMode) && (!(account == null ? void 0 : account.externalWallet) || includeWalletVerification);
114
+ const isEnabled = !!(embedded == null ? void 0 : embedded.isConnected) && !(embedded == null ? void 0 : embedded.isGuestMode) && (!((_a = para.authInfo) == null ? void 0 : _a.externalWallet) || includeWalletVerification);
114
115
  const [accountLinkInProgress, setAccountLinkInProgress] = useState(
115
116
  coreAccountLinkInProgress || void 0
116
117
  );
@@ -246,8 +247,8 @@ const AccountLinkProvider = ({ children }) => {
246
247
  {
247
248
  method,
248
249
  isCanceled: () => {
249
- var _a;
250
- return !!((_a = refs.popupWindow.current) == null ? void 0 : _a.closed);
250
+ var _a2;
251
+ return !!((_a2 = refs.popupWindow.current) == null ? void 0 : _a2.closed);
251
252
  },
252
253
  onOAuthUrl: (oAuthUrl) => {
253
254
  refs.popupWindow.current = openPopup({
@@ -31,7 +31,6 @@ export declare const defaultExternalWallet: {
31
31
  signMessage: () => Promise<any>;
32
32
  isSigningMessage: boolean;
33
33
  getWalletBalance: () => Promise<undefined>;
34
- isExternalWalletVerifying: boolean;
35
34
  requestInfo: (_: TExternalWallet) => Promise<ExternalWalletInfo>;
36
35
  disconnectBase: (_: TExternalWallet) => Promise<void>;
37
36
  };
@@ -52,7 +51,6 @@ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 's
52
51
  connectEmbeddedToExternalConnectors: () => Promise<void>;
53
52
  isSigningMessage: boolean;
54
53
  verifyWalletSignature: () => Promise<VerifyExternalWalletParams | undefined>;
55
- isExternalWalletVerifying?: boolean;
56
54
  requestInfo: (_: TExternalWallet, __: TWalletType) => Promise<ExternalWalletInfo>;
57
55
  };
58
56
  export declare const ExternalWalletContext: import("react").Context<Value>;
@@ -48,7 +48,6 @@ const defaultExternalWallet = {
48
48
  signMessage: () => Promise.resolve({}),
49
49
  isSigningMessage: false,
50
50
  getWalletBalance: () => Promise.resolve(void 0),
51
- isExternalWalletVerifying: false,
52
51
  requestInfo: (_) => Promise.resolve({}),
53
52
  disconnectBase: (_) => Promise.resolve()
54
53
  };
@@ -111,7 +110,6 @@ function ExternalWalletProvider({ children }) {
111
110
  const { mutateAsync: verifyExternalWallet } = useVerifyExternalWallet();
112
111
  const [qrUri, setQrUri] = useState();
113
112
  const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
114
- const [isExternalWalletVerifying, setIsExternalWalletVerifying] = useState(false);
115
113
  const [isSigningMessage, setIsSigningMessage] = useState(false);
116
114
  const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter((w) => externalWallets.includes(w.id.toUpperCase())).sort(
117
115
  (a, b) => externalWallets.indexOf(a.id.toUpperCase()) - externalWallets.indexOf(b.id.toUpperCase())
@@ -214,7 +212,6 @@ function ExternalWalletProvider({ children }) {
214
212
  const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
215
213
  var _a;
216
214
  setExternalWalletError();
217
- setIsExternalWalletVerifying(true);
218
215
  const wallet2 = Object.values(para.externalWallets)[0];
219
216
  const walletType = wallet2 == null ? void 0 : wallet2.type;
220
217
  let verifyExternalWalletParams;
@@ -284,28 +281,23 @@ function ExternalWalletProvider({ children }) {
284
281
  default:
285
282
  break;
286
283
  }
287
- if (verifyExternalWalletParams) {
288
- if (!(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.externalWallet) || !(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.signedMessage)) {
289
- console.error("No signature or address found on the verifyWalletSignature response.");
290
- return;
291
- }
292
- try {
293
- const d = yield verifyExternalWallet(verifyExternalWalletParams);
294
- if (wallet2 && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes((_a = wallet2.name) == null ? void 0 : _a.toUpperCase()))) {
295
- onNewAuthState(d);
296
- } else {
297
- setStep(ModalStep.LOGIN_DONE);
298
- }
299
- } catch (e) {
300
- console.error("Error verifying signature:", e);
301
- setExternalWalletError(["Signature verification failed."]);
302
- } finally {
303
- setIsExternalWalletVerifying(false);
284
+ if (!(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.externalWallet) || !(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.signedMessage)) {
285
+ console.error("No signature or address found on the verifyWalletSignature response.");
286
+ setExternalWalletError(["Signature verification failed."]);
287
+ return;
288
+ }
289
+ try {
290
+ const d = yield verifyExternalWallet(verifyExternalWalletParams);
291
+ if (wallet2 && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes((_a = wallet2.name) == null ? void 0 : _a.toUpperCase()))) {
292
+ yield onNewAuthState(d);
293
+ } else {
294
+ setStep(ModalStep.LOGIN_DONE);
304
295
  }
305
- return verifyExternalWalletParams;
296
+ } catch (e) {
297
+ console.error("Error verifying signature:", e);
298
+ setExternalWalletError(["Signature verification failed."]);
306
299
  }
307
- setIsExternalWalletVerifying(false);
308
- return void 0;
300
+ return verifyExternalWalletParams;
309
301
  }), [cosmosSignVerificationMessage, evmSignVerificationMessage, solanaSignVerificationMessage, wallet]);
310
302
  const signMessage = useCallback(
311
303
  (_0) => __async(this, [_0], function* ({ message, externalWallet: _externalWallet }) {
@@ -531,7 +523,6 @@ function ExternalWalletProvider({ children }) {
531
523
  signMessage,
532
524
  isSigningMessage,
533
525
  verifyWalletSignature,
534
- isExternalWalletVerifying,
535
526
  getWalletBalance,
536
527
  requestInfo,
537
528
  disconnectBase
@@ -554,7 +545,6 @@ function ExternalWalletProvider({ children }) {
554
545
  signMessage,
555
546
  isSigningMessage,
556
547
  verifyWalletSignature,
557
- isExternalWalletVerifying,
558
548
  getWalletBalance,
559
549
  requestInfo,
560
550
  disconnectBase
@@ -15,6 +15,8 @@ const createExternalWalletsSlice = (set) => ({
15
15
  setConnectionOnly: (connectionOnly) => set({ connectionOnly }),
16
16
  evmContext: EvmExternalWalletContext,
17
17
  setEvmContext: (evmContext) => set({ evmContext }),
18
+ evmLib: void 0,
19
+ setEvmLib: (evmLib) => set({ evmLib }),
18
20
  EvmProvider: void 0,
19
21
  setEvmProvider: (EvmProvider) => set({ EvmProvider }),
20
22
  evmWallets: [],
@@ -1,5 +1,6 @@
1
1
  import { Context, MutableRefObject } from 'react';
2
2
  import ParaWeb, { TWalletType } from '@getpara/web-sdk';
3
+ import * as paraEvmLib from '@getpara/evm-wallet-connectors';
3
4
  import { EvmExternalWalletContextType, ParaEvmProvider, WalletList as EvmWalletList } from '@getpara/evm-wallet-connectors';
4
5
  import { CosmosExternalWalletContextType, ParaCosmosProvider, WalletList as CosmosWalletList } from '@getpara/cosmos-wallet-connectors';
5
6
  import { ParaSolanaProvider, SolanaExternalWalletContextType, WalletList as SolanaWalletList } from '@getpara/solana-wallet-connectors';
@@ -44,6 +45,8 @@ export interface ExternalWalletsSlice {
44
45
  setIncludeWalletVerification: (_: boolean) => void;
45
46
  externalWalletsWithFullAuth: TExternalWallet[];
46
47
  setExternalWalletsWithFullAuth: (_: TExternalWallet[]) => void;
48
+ evmLib: typeof paraEvmLib | undefined;
49
+ setEvmLib: (_: typeof paraEvmLib) => void;
47
50
  evmContext: Context<EvmExternalWalletContextType>;
48
51
  setEvmContext: (_: Context<EvmExternalWalletContextType>) => void;
49
52
  EvmProvider?: typeof ParaEvmProvider;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk",
3
- "version": "2.0.0-alpha.27",
3
+ "version": "2.0.0-alpha.29",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.27",
9
- "@getpara/react-components": "2.0.0-alpha.27",
10
- "@getpara/web-sdk": "2.0.0-alpha.27",
8
+ "@getpara/react-common": "2.0.0-alpha.29",
9
+ "@getpara/react-components": "2.0.0-alpha.29",
10
+ "@getpara/web-sdk": "2.0.0-alpha.29",
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.27",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.27",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.27",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.29",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.29",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.29",
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": "a54f63445995abd13220eda3d63809728e4b5f7e",
41
+ "gitHead": "7b90cb5a1a83f9bce9d61bd2baf190c47b58b705",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@getpara/cosmos-wallet-connectors": "^2.0.0-alpha.26",