@getpara/react-sdk-lite 2.0.0-alpha.33 → 2.0.0-alpha.34

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 (25) hide show
  1. package/dist/modal/components/Account/AccountProfile.js +22 -4
  2. package/dist/modal/components/Account/AccountProfileLink.js +10 -5
  3. package/dist/modal/components/Account/AccountProfileLinkOptions.js +21 -13
  4. package/dist/modal/components/Account/AccountProfileUnlink.js +6 -4
  5. package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -1
  6. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +3 -54
  7. package/dist/modal/components/AddFunds/AddFundsProvider.js +2 -6
  8. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +2 -2
  9. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +6 -6
  10. package/dist/modal/components/ExternalWallets/ExternalWallets.js +5 -5
  11. package/dist/modal/components/common.d.ts +7 -5
  12. package/dist/modal/components/common.js +5 -4
  13. package/dist/modal/constants/constants.js +1 -1
  14. package/dist/modal/constants/oAuthLogos.d.ts +2 -3
  15. package/dist/modal/constants/oAuthLogos.js +28 -28
  16. package/dist/modal/stores/modal/actions.js +2 -2
  17. package/dist/modal/stores/modal/useModalStore.d.ts +8 -2
  18. package/dist/modal/stores/modal/useModalStore.js +1 -1
  19. package/dist/provider/hooks/mutations/useLinkAccount.d.ts +30 -1
  20. package/dist/provider/hooks/mutations/useLinkAccount.js +3 -1
  21. package/dist/provider/providers/AccountLinkProvider.d.ts +4 -4
  22. package/dist/provider/providers/AccountLinkProvider.js +14 -5
  23. package/dist/provider/providers/ExternalWalletProvider.d.ts +6 -5
  24. package/dist/provider/providers/ExternalWalletProvider.js +19 -24
  25. package/package.json +8 -8
@@ -12,7 +12,8 @@ import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
12
12
  import { truncateAddress } from "@getpara/web-sdk";
13
13
  import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
14
14
  import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
15
- import { getAccountTypeName } from "../../constants/oAuthLogos.js";
15
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
16
+ import { ACCOUNT_TYPES } from "../../constants/oAuthLogos.js";
16
17
  const Entry = ({
17
18
  identifier,
18
19
  icon,
@@ -48,6 +49,7 @@ const AccountProfile = () => {
48
49
  var _a, _b, _c, _d, _e, _f;
49
50
  const para = useClient();
50
51
  const { data: linkedAccounts } = useLinkedAccounts();
52
+ const { wallets } = useExternalWallets();
51
53
  const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
52
54
  if (!para) {
53
55
  return null;
@@ -60,7 +62,7 @@ const AccountProfile = () => {
60
62
  Entry,
61
63
  {
62
64
  icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: externalWallet.providerId, size: "24px" }),
63
- name: (_c = (_b = externalWallet.ensName) != null ? _b : getAccountTypeName(externalWallet.providerId)) != null ? _c : "",
65
+ name: (_c = (_b = externalWallet.ensName) != null ? _b : externalWallet.provider) != null ? _c : "",
64
66
  address: (_d = externalWallet.addressBech32) != null ? _d : externalWallet.address,
65
67
  addressShort: truncateAddress((_e = externalWallet.addressBech32) != null ? _e : externalWallet.address, externalWallet.type, {
66
68
  prefix: para.cosmosPrefix
@@ -90,11 +92,26 @@ const AccountProfile = () => {
90
92
  ].map((linkedAccount) => {
91
93
  var _a2, _b2, _c2, _d2, _e2;
92
94
  const { identifier, displayName, type, isPrimary = false, externalWallet: externalWallet2 } = linkedAccount;
95
+ const externalWalletConnector = wallets.find((wallet) => wallet.id === (externalWallet2 == null ? void 0 : externalWallet2.providerId));
96
+ let accountType = type;
97
+ let src = void 0;
98
+ if (externalWallet2) {
99
+ if (externalWalletConnector) {
100
+ accountType = void 0;
101
+ src = externalWalletConnector.iconUrl;
102
+ } else if (externalWallet2.providerId && ACCOUNT_TYPES[externalWallet2.providerId]) {
103
+ accountType = externalWallet2.providerId;
104
+ src = void 0;
105
+ } else {
106
+ accountType = "EXTERNAL_WALLET";
107
+ src = void 0;
108
+ }
109
+ }
93
110
  return /* @__PURE__ */ jsx(
94
111
  Entry,
95
112
  {
96
- icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: (_a2 = externalWallet2 == null ? void 0 : externalWallet2.providerId) != null ? _a2 : type, size: "24px" }),
97
- name: externalWallet2 ? (_c2 = (_b2 = externalWallet2.ensName) != null ? _b2 : getAccountTypeName(externalWallet2.providerId)) != null ? _c2 : "" : displayName != null ? displayName : identifier,
113
+ icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, src, size: "24px" }),
114
+ name: externalWallet2 ? (_c2 = (_b2 = (_a2 = externalWallet2.ensName) != null ? _a2 : externalWalletConnector == null ? void 0 : externalWalletConnector.name) != null ? _b2 : externalWallet2.provider) != null ? _c2 : "" : displayName != null ? displayName : identifier,
98
115
  address: (_d2 = externalWallet2 == null ? void 0 : externalWallet2.addressBech32) != null ? _d2 : externalWallet2 == null ? void 0 : externalWallet2.address,
99
116
  addressShort: externalWallet2 ? truncateAddress((_e2 = externalWallet2.addressBech32) != null ? _e2 : externalWallet2.address, externalWallet2.type, {
100
117
  prefix: para.cosmosPrefix
@@ -126,6 +143,7 @@ const Section = safeStyled.div`
126
143
  const Content = safeStyled(Section)``;
127
144
  const Title = safeStyled(CpslText)``;
128
145
  const EntryContainer = safeStyled.div`
146
+ overflow: hidden;
129
147
  position: relative;
130
148
  width: 100%;
131
149
  display: flex;
@@ -29,7 +29,7 @@ function AccountProfileLink() {
29
29
  linkAccount,
30
30
  isLinkAccountPending,
31
31
  resetMutations
32
- } = useAccountLinking(), { wallets } = useExternalWallets(), { mutate: resendVerificationCode } = useResendVerificationCode(), accountLinkType = accountLinkInProgress == null ? void 0 : accountLinkInProgress.type, externalWalletProvider = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId, externalWalletType = (_d = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletType) != null ? _d : (_c = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _c.type, accountLinkIcon = externalWalletProvider != null ? externalWalletProvider : accountLinkType, isTelegram = accountLinkType === "TELEGRAM", {
32
+ } = useAccountLinking(), { wallets } = useExternalWallets(), { mutate: resendVerificationCode } = useResendVerificationCode(), accountLinkType = accountLinkInProgress == null ? void 0 : accountLinkInProgress.type, externalWalletProvider = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId, externalWalletType = (_d = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletType) != null ? _d : (_c = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _c.type, externalWallet = wallets.find((w) => w.id === externalWalletProvider), isTelegram = accountLinkType === "TELEGRAM", {
33
33
  url,
34
34
  status: telegramStatus,
35
35
  isLoaded,
@@ -67,12 +67,17 @@ function AccountProfileLink() {
67
67
  HeroSpinner,
68
68
  {
69
69
  status,
70
- icon: status === "success" ? /* @__PURE__ */ jsx(HeroSuccessIcon, {}) : /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: accountLinkIcon }),
70
+ icon: status === "success" ? /* @__PURE__ */ jsx(HeroSuccessIcon, {}) : /* @__PURE__ */ jsx(
71
+ HeroAccountTypeIcon,
72
+ {
73
+ accountType: externalWallet ? void 0 : accountLinkType,
74
+ src: externalWallet ? externalWallet.iconUrl : void 0
75
+ }
76
+ ),
71
77
  text: message
72
78
  }
73
79
  );
74
- ``;
75
- const onTryAgain = externalWalletProvider && externalWalletType ? () => linkAccount({ externalWallet: { internalId: externalWalletProvider, type: externalWalletType } }) : accountLinkType && accountLinkType !== "EXTERNAL_WALLET" ? () => linkAccount({ type: accountLinkType }) : void 0;
80
+ const onTryAgain = externalWalletProvider && externalWalletType ? () => linkAccount({ externalWallet: { provider: externalWalletProvider, type: externalWalletType } }) : accountLinkType && accountLinkType !== "EXTERNAL_WALLET" ? () => linkAccount({ type: accountLinkType }) : void 0;
76
81
  const tryAgain = onTryAgain ? /* @__PURE__ */ jsxs(CpslButton, { variant: "secondary", fullWidth: true, onClick: onTryAgain, children: [
77
82
  /* @__PURE__ */ jsx(CpslIcon, { icon: "refresh", slot: "start" }),
78
83
  "Try Again"
@@ -148,7 +153,7 @@ function AccountProfileLink() {
148
153
  wallet: commonWallet,
149
154
  isSelfFetching: true,
150
155
  onConnectWc: (w) => __async(this, null, function* () {
151
- yield linkAccount({ externalWallet: { internalId: w.internalId, type: w.type } });
156
+ yield linkAccount({ externalWallet: { provider: w.id, type: w.type } });
152
157
  })
153
158
  }
154
159
  );
@@ -8,12 +8,8 @@ import { getAccountTypeName } from "../../constants/oAuthLogos.js";
8
8
  import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
9
9
  import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
10
10
  import { useEffect, useMemo } from "react";
11
- import { EXTERNAL_WALLET_TYPES } from "@getpara/web-sdk";
12
11
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
13
12
  import { safeStyled } from "@getpara/react-common";
14
- function isExternalWallet(str) {
15
- return EXTERNAL_WALLET_TYPES.includes(str);
16
- }
17
13
  function AccountProfileLinkOptions() {
18
14
  const para = useInternalClient();
19
15
  const { accountLinkOptions, linkAccount, isLinkAccountPending, linkAccountError, setLinkAccountError, resetMutations } = useAccountLinking();
@@ -27,14 +23,14 @@ function AccountProfileLinkOptions() {
27
23
  const options = useMemo(() => {
28
24
  const baseOptions = externalWalletIndex >= 0 ? [
29
25
  ...accountLinkOptions.slice(0, externalWalletIndex),
30
- ...EXTERNAL_WALLET_TYPES,
26
+ ...wallets.map((wallet) => wallet.id),
31
27
  ...accountLinkOptions.slice(externalWalletIndex + 1)
32
28
  ] : accountLinkOptions;
33
29
  return Array.from(
34
30
  new Set(
35
31
  baseOptions.filter((option) => {
36
- if (!isExternalWallet(option) || (connectedWallet == null ? void 0 : connectedWallet.internalId) !== option && wallets.some(({ type, internalId, installed, isMobile }) => {
37
- return (installed || isMobile) && (para == null ? void 0 : para.supportedWalletTypes.some((obj) => obj.type === type)) && internalId === option;
32
+ if (!wallets.some((wallet) => wallet.id === option) || (connectedWallet == null ? void 0 : connectedWallet.id) !== option && wallets.some(({ type, id, installed, isMobile }) => {
33
+ return (installed || isMobile) && (para == null ? void 0 : para.supportedWalletTypes.some((obj) => obj.type === type)) && id === option;
38
34
  })) {
39
35
  return true;
40
36
  }
@@ -47,8 +43,8 @@ function AccountProfileLinkOptions() {
47
43
  resetMutations();
48
44
  setLinkAccountError(null);
49
45
  }, []);
50
- const getExternalWalletType = (internalId) => {
51
- const allWallets = wallets.filter((wallet) => wallet.internalId === internalId);
46
+ const getExternalWalletType = (id) => {
47
+ const allWallets = wallets.filter((wallet) => wallet.id === id);
52
48
  if (allWallets.length === 1) {
53
49
  return allWallets[0].type;
54
50
  }
@@ -73,18 +69,30 @@ function AccountProfileLinkOptions() {
73
69
  isOptions && /* @__PURE__ */ jsx(CpslDivider, { children: "or" })
74
70
  ] }),
75
71
  isOptions && /* @__PURE__ */ jsx(GradientScroll, { height: "320px", children: options.filter((option) => option !== "EMAIL" && option !== "PHONE").map((option) => {
76
- const isWallet = isExternalWallet(option);
72
+ const externalWallet = wallets.find((wallet) => wallet.id === option);
77
73
  return /* @__PURE__ */ jsxs(
78
74
  Option,
79
75
  {
80
76
  fullWidth: true,
81
77
  variant: "tertiary",
82
78
  onClick: () => linkAccount(
83
- isWallet ? { externalWallet: { internalId: option, type: getExternalWalletType(option) } } : { type: option }
79
+ !!externalWallet ? {
80
+ externalWallet: {
81
+ provider: externalWallet.id,
82
+ type: getExternalWalletType(externalWallet.id)
83
+ }
84
+ } : { type: option }
84
85
  ),
85
86
  children: [
86
- /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: option, size: "24px" }),
87
- /* @__PURE__ */ jsx(CpslText, { color: "contrast", variant: "bodyM", children: getAccountTypeName(option) })
87
+ /* @__PURE__ */ jsx(
88
+ AccountTypeIcon,
89
+ {
90
+ accountType: externalWallet ? void 0 : option,
91
+ src: externalWallet ? externalWallet.iconUrl : void 0,
92
+ size: "24px"
93
+ }
94
+ ),
95
+ /* @__PURE__ */ jsx(CpslText, { color: "contrast", variant: "bodyM", children: externalWallet ? externalWallet.name : getAccountTypeName(option) })
88
96
  ]
89
97
  },
90
98
  option
@@ -9,19 +9,21 @@ import { useAccountLinking } from "../../../provider/providers/AccountLinkProvid
9
9
  import { safeStyled } from "@getpara/react-common";
10
10
  function AccountProfileUnlink() {
11
11
  var _a, _b;
12
- const { unlinkingAccount, unlinkAccountConfirm, isUnlinkAccountPending } = useAccountLinking(), [accountType, setAccountType] = useState((_b = (_a = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a.providerId) != null ? _b : unlinkingAccount == null ? void 0 : unlinkingAccount.type);
12
+ const { unlinkingAccount, unlinkAccountConfirm, isUnlinkAccountPending } = useAccountLinking(), [accountType, setAccountType] = useState((_b = (_a = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a.providerId) != null ? _b : unlinkingAccount == null ? void 0 : unlinkingAccount.type), [isUnlinkingExternalWallet, setIsUnlinkingExternalWallet] = useState(false);
13
13
  useEffect(() => {
14
14
  var _a2, _b2;
15
15
  if (unlinkingAccount) {
16
- setAccountType((_b2 = (_a2 = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a2.providerId) != null ? _b2 : unlinkingAccount == null ? void 0 : unlinkingAccount.type);
16
+ setAccountType((_b2 = (_a2 = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a2.provider) != null ? _b2 : unlinkingAccount == null ? void 0 : unlinkingAccount.type);
17
+ setIsUnlinkingExternalWallet(!!(unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet));
17
18
  }
18
19
  }, [unlinkingAccount]);
19
20
  return /* @__PURE__ */ jsxs(Content, { children: [
20
21
  /* @__PURE__ */ jsxs(Upper, { children: [
21
22
  /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "80px", inset: "5px" }),
22
23
  /* @__PURE__ */ jsxs(Message, { variant: "bodyM", weight: "semiBold", color: "contrast", children: [
23
- "Are you sure you want to unlink your ",
24
- getAccountTypeName(accountType, { inline: true }),
24
+ "Are you sure you want to unlink your",
25
+ " ",
26
+ isUnlinkingExternalWallet ? accountType : getAccountTypeName(accountType, { inline: true }),
25
27
  "?"
26
28
  ] })
27
29
  ] }),
@@ -1 +1 @@
1
- export declare const AddFundsAwaiting: () => import("react/jsx-runtime").JSX.Element;
1
+ export declare const AddFundsAwaiting: () => null;
@@ -1,63 +1,15 @@
1
1
  "use client";
2
- import {
3
- __spreadProps,
4
- __spreadValues
5
- } from "../../../chunk-MMUBH76A.js";
6
- import { jsx } from "react/jsx-runtime";
7
- import { StepContainer } from "../common.js";
8
- import { OnRampProvider } from "@getpara/web-sdk";
2
+ import "../../../chunk-MMUBH76A.js";
9
3
  import { useModalStore } from "../../stores/index.js";
10
- import { lazy, useEffect, useMemo, useState } from "react";
4
+ import { useEffect } from "react";
11
5
  import { ModalStep } from "../../utils/steps.js";
12
- import { RampEmbed } from "@getpara/react-common";
13
- import { safeStyled } from "@getpara/react-common";
14
- import { useGoBack } from "../../hooks/useGoBack.js";
15
- import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
16
- import { useStore } from "../../../provider/stores/useStore.js";
17
6
  const STEPS = {
18
7
  CANCELLED: ModalStep.ADD_FUNDS_FAILURE,
19
8
  FINISHED: ModalStep.ADD_FUNDS_SUCCESS
20
9
  };
21
10
  const AddFundsAwaiting = () => {
22
11
  const setStep = useModalStore((state) => state.setStep);
23
- const goBack = useGoBack();
24
- const onRampConfig = useModalStore((state) => state.onRampConfig);
25
12
  const onRampPurchase = useModalStore((state) => state.onRampPurchase);
26
- const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
27
- const para = useInternalClient();
28
- const appName = useStore((state) => state.appName);
29
- const isDark = useStore((state) => state.isDarkTheme);
30
- const [MoonPayEmbed, setMoonPayEmbed] = useState();
31
- const props = {
32
- para,
33
- appName,
34
- onRampConfig,
35
- onRampPurchase,
36
- isDark,
37
- isEmbedded: true,
38
- setOnRampPurchase,
39
- onClose: goBack
40
- };
41
- useEffect(() => {
42
- const _MoonPayEmbed = lazy(() => import("./MoonPayEmbed.js"));
43
- if (_MoonPayEmbed) {
44
- setMoonPayEmbed(_MoonPayEmbed);
45
- }
46
- }, []);
47
- const onRampEmbed = useMemo(() => {
48
- var _a, _b;
49
- if (!(onRampPurchase == null ? void 0 : onRampPurchase.id) || !props.onRampConfig) {
50
- return null;
51
- }
52
- switch (onRampPurchase == null ? void 0 : onRampPurchase.provider) {
53
- case OnRampProvider.MOONPAY:
54
- return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx(MoonPayEmbed, __spreadProps(__spreadValues({}, props), { onRampConfig: props.onRampConfig }));
55
- case OnRampProvider.RAMP:
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
- }
60
- }, [onRampPurchase == null ? void 0 : onRampPurchase.provider, MoonPayEmbed]);
61
13
  useEffect(() => {
62
14
  let timeoutId;
63
15
  if ((onRampPurchase == null ? void 0 : onRampPurchase.status) && ["CANCELLED", "FINISHED"].includes(onRampPurchase.status)) {
@@ -68,11 +20,8 @@ const AddFundsAwaiting = () => {
68
20
  }
69
21
  return () => clearTimeout(timeoutId);
70
22
  }, [onRampPurchase == null ? void 0 : onRampPurchase.status]);
71
- return /* @__PURE__ */ jsx(Container, { $wide: true, children: onRampEmbed });
23
+ return null;
72
24
  };
73
- const Container = safeStyled(StepContainer)`
74
- flex: 1;
75
- `;
76
25
  export {
77
26
  AddFundsAwaiting
78
27
  };
@@ -14,8 +14,7 @@ import { useStore } from "../../../provider/stores/useStore.js";
14
14
  import { motion, AnimatePresence } from "framer-motion";
15
15
  import { OnRampProviderButton } from "../OnRampComponents/OnRampProviderButton.js";
16
16
  import { useWallet } from "../../../provider/index.js";
17
- import { EnabledFlow, OnRampProvider, OnRampPurchaseType } from "@getpara/web-sdk";
18
- import { ModalStep } from "../../utils/steps.js";
17
+ import { EnabledFlow, OnRampPurchaseType } from "@getpara/web-sdk";
19
18
  import { contentMotionProps } from "./common.js";
20
19
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
21
20
  function AddFundsProvider() {
@@ -26,7 +25,6 @@ function AddFundsProvider() {
26
25
  });
27
26
  const onRampConfig = useModalStore((state) => state.onRampConfig);
28
27
  const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
29
- const setModalStep = useModalStore((state) => state.setStep);
30
28
  const { asset, network, fiatQuantity, isProviderAllowed, tab } = useAddFunds();
31
29
  const { data: activeWallet } = useWallet();
32
30
  return /* @__PURE__ */ jsxs(Container, __spreadProps(__spreadValues({}, contentMotionProps), { children: [
@@ -53,11 +51,10 @@ function AddFundsProvider() {
53
51
  index,
54
52
  onClick: () => __async(this, null, function* () {
55
53
  if (!(activeWallet == null ? void 0 : activeWallet.type)) return;
56
- const isPopup = id !== OnRampProvider.RAMP;
57
54
  const { onRampPurchase: newOnRampPurchase } = yield para.initiateOnRampTransaction({
58
55
  walletId: activeWallet.isExternal ? void 0 : activeWallet.id,
59
56
  externalWalletAddress: activeWallet.isExternal ? activeWallet.id : void 0,
60
- shouldOpenPopup: isPopup,
57
+ shouldOpenPopup: true,
61
58
  params: {
62
59
  type: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL,
63
60
  walletType: activeWallet.type,
@@ -69,7 +66,6 @@ function AddFundsProvider() {
69
66
  }
70
67
  });
71
68
  setOnRampPurchase(__spreadProps(__spreadValues({}, newOnRampPurchase), { fiat: "USD" }));
72
- !isPopup && setModalStep(ModalStep.ADD_FUNDS_AWAITING);
73
69
  })
74
70
  },
75
71
  id
@@ -117,7 +117,7 @@ const AuthMainStepContent = ({
117
117
  GuestMode,
118
118
  {
119
119
  href: "#",
120
- isDark,
120
+ $isDark: isDark,
121
121
  onClick: (e) => {
122
122
  e.preventDefault();
123
123
  createGuestWallets();
@@ -153,7 +153,7 @@ const GuestMode = safeStyled.a`
153
153
  align-items: center;
154
154
  width: 100%;
155
155
  height: 50px;
156
- color: ${({ isDark }) => isDark ? "white" : "black"};
156
+ color: ${({ $isDark }) => $isDark ? "white" : "black"};
157
157
  text-decoration: none;
158
158
  font-size: 16px;
159
159
  font-weight: 500;
@@ -11,23 +11,23 @@ import { useAccountLinking } from "../../../provider/providers/AccountLinkProvid
11
11
  const ExternalWalletNetworkSelectStep = () => {
12
12
  var _a, _b;
13
13
  const setStep = useModalStore((state) => state.setStep);
14
- const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
15
- const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
14
+ const selectedExternalWallet = useModalStore((state) => state.selectedExternalWallet);
15
+ const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
16
16
  const { wallets, connectExternalWallet } = useExternalWallets();
17
17
  const { accountLinkInProgress, linkAccount } = useAccountLinking();
18
18
  const externalWalletProvider = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId;
19
- if (!accountLinkInProgress && !selectedExternalWalletId) {
19
+ if (!accountLinkInProgress && !selectedExternalWallet) {
20
20
  setStep(ModalStep.ACCOUNT_MAIN);
21
21
  return null;
22
22
  }
23
- const availableWallets = wallets.filter((w) => w.internalId === (externalWalletProvider != null ? externalWalletProvider : selectedExternalWalletId));
23
+ const availableWallets = wallets.filter((w) => w.id === (externalWalletProvider != null ? externalWalletProvider : selectedExternalWallet == null ? void 0 : selectedExternalWallet.id));
24
24
  const firstWallet = availableWallets[0];
25
25
  const handleWalletClick = (wallet) => () => {
26
26
  if (accountLinkInProgress) {
27
- linkAccount({ externalWallet: wallet });
27
+ linkAccount({ externalWallet: { provider: wallet.id } });
28
28
  return;
29
29
  }
30
- setSelectedExternalWalletId(wallet.internalId);
30
+ setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
31
31
  setStep(ModalStep.EX_WALLET_SELECTED);
32
32
  if (wallet.installed || wallet.internalId === "FARCASTER") {
33
33
  connectExternalWallet(wallet);
@@ -14,7 +14,7 @@ import { useExternalWallets } from "../../../provider/providers/ExternalWalletPr
14
14
  const HAS_MORE_LENGTH = 3;
15
15
  const ExternalWallets = () => {
16
16
  const { wallets: allWallets, connectExternalWallet } = useExternalWallets();
17
- const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
17
+ const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
18
18
  const setStep = useModalStore((state) => state.setStep);
19
19
  const showAll = useModalStore((state) => state.step === ModalStep.EX_WALLET_MORE);
20
20
  const authLayout = useModalStore((state) => state.authLayout);
@@ -34,11 +34,11 @@ const ExternalWallets = () => {
34
34
  const handleWalletClick = (wallet) => () => {
35
35
  const shouldShowNetworkSelection = allWallets.filter((w) => w.id === wallet.id).length > 1;
36
36
  if (shouldShowNetworkSelection) {
37
- setSelectedExternalWalletId(wallet.internalId);
37
+ setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
38
38
  setStep(ModalStep.EX_WALLET_NETWORK_SELECT);
39
39
  return;
40
40
  }
41
- setSelectedExternalWalletId(wallet.internalId);
41
+ setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
42
42
  setStep(ModalStep.EX_WALLET_SELECTED);
43
43
  if (wallet.installed) {
44
44
  connectExternalWallet(wallet);
@@ -141,8 +141,8 @@ const Badge = safeStyled.div`
141
141
  }
142
142
  `;
143
143
  const InstalledIndicator = safeStyled.span`
144
- width: 8px;
145
- height: 8px;
144
+ width: 4px;
145
+ height: 4px;
146
146
  border-radius: 100%;
147
147
  background-color: var(--cpsl-color-utility-green);
148
148
  `;
@@ -1,5 +1,5 @@
1
1
  import { CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
2
- import { Network, OnRampAsset, TExternalWallet, TLinkedAccountType } from '@getpara/web-sdk';
2
+ import { Network, OnRampAsset, TLinkedAccountType } from '@getpara/web-sdk';
3
3
  import { PropsWithChildren } from 'react';
4
4
  export declare const SpinnerContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
5
  export declare const QRContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -41,13 +41,15 @@ export declare const ErrorContainer: import("styled-components/dist/types.js").I
41
41
  export declare const ErrorIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
42
42
  ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
43
43
  }, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
44
- export declare function AccountTypeIcon({ accountType, size, inset, }: {
45
- accountType?: TLinkedAccountType | TExternalWallet;
44
+ export declare function AccountTypeIcon({ accountType, size, inset, src, }: {
45
+ accountType?: TLinkedAccountType | string;
46
46
  size?: string;
47
47
  inset?: string;
48
+ src?: string;
48
49
  }): import("react/jsx-runtime").JSX.Element | null;
49
- export declare function HeroAccountTypeIcon({ accountType }: {
50
- accountType: TLinkedAccountType | TExternalWallet;
50
+ export declare function HeroAccountTypeIcon({ accountType, src }: {
51
+ accountType?: TLinkedAccountType | string;
52
+ src?: string;
51
53
  }): import("react/jsx-runtime").JSX.Element;
52
54
  export declare function HeroSuccessIcon(): import("react/jsx-runtime").JSX.Element;
53
55
  export declare function GradientScroll({ height, gap, children }: PropsWithChildren<{
@@ -157,7 +157,8 @@ const ErrorIcon = safeStyled(CpslIcon)`
157
157
  function AccountTypeIcon({
158
158
  accountType,
159
159
  size,
160
- inset
160
+ inset,
161
+ src
161
162
  }) {
162
163
  var _a;
163
164
  const isDark = useStore((state) => {
@@ -165,13 +166,13 @@ function AccountTypeIcon({
165
166
  return ((_b = (_a2 = state.modalConfig) == null ? void 0 : _a2.theme) == null ? void 0 : _b.mode) === "dark";
166
167
  });
167
168
  const data = accountType ? ACCOUNT_TYPES[accountType] : null;
168
- return data ? /* @__PURE__ */ jsx(CpslIcon, { size, inset, icon: (_a = data.logoBranded) != null ? _a : data.logo, invert: isDark && data.isDark }) : null;
169
+ return data || src ? /* @__PURE__ */ jsx(CpslIcon, { size, inset, icon: (_a = data == null ? void 0 : data.logoBranded) != null ? _a : data == null ? void 0 : data.logo, src, invert: isDark && (data == null ? void 0 : data.isDark) }) : null;
169
170
  }
170
- function HeroAccountTypeIcon({ accountType }) {
171
+ function HeroAccountTypeIcon({ accountType, src }) {
171
172
  if (accountType === "EMAIL" || accountType === "PHONE") {
172
173
  return /* @__PURE__ */ jsx(HeroGenericIcon, { accountType });
173
174
  }
174
- return /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "60px" });
175
+ return /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "60px", src });
175
176
  }
176
177
  function HeroSuccessIcon() {
177
178
  return /* @__PURE__ */ jsx(CpslIcon, { icon: "checkCircleFilled", size: "80px", style: { ["--icon-color"]: "var(--cpsl-color-utility-green" } });
@@ -121,7 +121,7 @@ const BODY_MOTION_VARIANTS = {
121
121
  const BODY_TRANSITION = {
122
122
  duration: 0.2
123
123
  };
124
- const SDK_VERSION = "2.0.0-alpha.33";
124
+ const SDK_VERSION = "2.0.0-alpha.34";
125
125
  export {
126
126
  BODY_MOTION_VARIANTS,
127
127
  BODY_TRANSITION,
@@ -1,8 +1,7 @@
1
- import { TExternalWallet } from '@getpara/web-sdk';
2
1
  import { IconType } from '@getpara/react-components';
3
2
  import { TLinkedAccountType } from '@getpara/web-sdk';
4
3
  export declare const ACCOUNT_TYPES: {
5
- [key in TLinkedAccountType | TExternalWallet]: {
4
+ [key in TLinkedAccountType | string]: {
6
5
  logo: IconType;
7
6
  logoBranded?: IconType;
8
7
  name: string;
@@ -11,7 +10,7 @@ export declare const ACCOUNT_TYPES: {
11
10
  isExternalWallet?: boolean;
12
11
  };
13
12
  };
14
- export declare function getAccountTypeName(type: TLinkedAccountType | TExternalWallet | undefined, { inline }?: {
13
+ export declare function getAccountTypeName(type: TLinkedAccountType | string | undefined, { inline }?: {
15
14
  inline?: boolean;
16
15
  }): string | undefined;
17
16
  export declare function getAccountTypeLogo(type: TLinkedAccountType | undefined): IconType | undefined;
@@ -1,143 +1,143 @@
1
1
  "use client";
2
2
  import "../../chunk-MMUBH76A.js";
3
3
  const ACCOUNT_TYPES = {
4
- EMAIL: {
4
+ "EMAIL": {
5
5
  logo: "mail",
6
6
  name: "Email",
7
7
  inline: "email address",
8
8
  isDark: true
9
9
  },
10
- PHONE: {
10
+ "PHONE": {
11
11
  logo: "phone",
12
12
  name: "Phone",
13
13
  inline: "phone number",
14
14
  isDark: true
15
15
  },
16
- EXTERNAL_WALLET: {
16
+ "EXTERNAL_WALLET": {
17
17
  logo: "wallet",
18
18
  name: "External Wallet",
19
19
  inline: "external wallet",
20
20
  isDark: true
21
21
  },
22
- GOOGLE: {
22
+ "GOOGLE": {
23
23
  logo: "google",
24
24
  logoBranded: "googleBrand",
25
25
  name: "Google"
26
26
  },
27
- TWITTER: {
27
+ "TWITTER": {
28
28
  logo: "twitter",
29
29
  logoBranded: "twitterBrand",
30
30
  name: "X / Twitter",
31
31
  inline: "X account",
32
32
  isDark: true
33
33
  },
34
- APPLE: {
34
+ "APPLE": {
35
35
  logo: "apple",
36
36
  logoBranded: "appleBrand",
37
37
  name: "Apple",
38
38
  isDark: true
39
39
  },
40
- DISCORD: {
40
+ "DISCORD": {
41
41
  logo: "discord",
42
42
  logoBranded: "discordBrand",
43
43
  name: "Discord"
44
44
  },
45
- FACEBOOK: {
45
+ "FACEBOOK": {
46
46
  logo: "facebook",
47
47
  logoBranded: "facebookBrand",
48
48
  name: "Facebook"
49
49
  },
50
- FARCASTER: {
50
+ "FARCASTER": {
51
51
  logo: "farcaster",
52
52
  logoBranded: "farcasterBrand",
53
53
  name: "Farcaster"
54
54
  },
55
- TELEGRAM: {
55
+ "TELEGRAM": {
56
56
  logo: "telegram",
57
57
  logoBranded: "telegramBrand",
58
58
  name: "Telegram"
59
59
  },
60
- METAMASK: {
60
+ "MetaMask": {
61
61
  logo: "metamask",
62
62
  name: "MetaMask",
63
63
  isExternalWallet: true
64
64
  },
65
- RAINBOW: {
65
+ "Rainbow": {
66
66
  logo: "rainbow",
67
67
  name: "Rainbow",
68
68
  isExternalWallet: true
69
69
  },
70
- COINBASE: {
70
+ "Coinbase Wallet": {
71
71
  logo: "coinbase",
72
72
  name: "Coinbase Wallet",
73
73
  isExternalWallet: true
74
74
  },
75
- WALLETCONNECT: {
75
+ "WalletConnect": {
76
76
  logo: "walletConnect",
77
77
  name: "WalletConnect",
78
78
  isExternalWallet: true
79
79
  },
80
- ZERION: {
80
+ "Zerion": {
81
81
  logo: "zerion",
82
82
  name: "Zerion",
83
83
  isExternalWallet: true
84
84
  },
85
- SAFE: {
85
+ "Safe": {
86
86
  logo: "safe",
87
87
  name: "Safe",
88
88
  isExternalWallet: true
89
89
  },
90
- RABBY: {
90
+ "Rabby": {
91
91
  logo: "rabby",
92
92
  name: "Rabby",
93
93
  isExternalWallet: true
94
94
  },
95
- OKX: {
95
+ "OKX Wallet": {
96
96
  logo: "okx",
97
- name: "OKX",
97
+ name: "OKX Wallet",
98
98
  isExternalWallet: true
99
99
  },
100
- PHANTOM: {
100
+ "Phantom": {
101
101
  logo: "phantom",
102
102
  name: "Phantom",
103
103
  isExternalWallet: true
104
104
  },
105
- GLOW: {
105
+ "Glow": {
106
106
  logo: "glow",
107
107
  name: "Glow",
108
108
  isExternalWallet: true
109
109
  },
110
- BACKPACK: {
110
+ "Backpack": {
111
111
  logo: "backpack",
112
112
  name: "Backpack",
113
113
  isExternalWallet: true
114
114
  },
115
- KEPLR: {
115
+ "Keplr": {
116
116
  logo: "keplr",
117
117
  name: "Keplr",
118
118
  isExternalWallet: true
119
119
  },
120
- LEAP: {
120
+ "Leap": {
121
121
  logo: "leap",
122
122
  name: "Leap",
123
123
  isExternalWallet: true
124
124
  },
125
- HAHA: {
125
+ "HaHa": {
126
126
  logo: "haha",
127
127
  name: "HaHa",
128
128
  isExternalWallet: true
129
129
  },
130
- COSMOSTATION: {
130
+ "Cosmostation": {
131
131
  logo: "cosmostation",
132
132
  name: "Cosmostation",
133
133
  isExternalWallet: true
134
134
  },
135
- SOLFLARE: {
135
+ "Solflare": {
136
136
  logo: "solflare",
137
137
  name: "Solflare",
138
138
  isExternalWallet: true
139
139
  },
140
- VALORA: {
140
+ "Valora": {
141
141
  logo: "valora",
142
142
  name: "Valora",
143
143
  isExternalWallet: true
@@ -49,7 +49,7 @@ const getActions = (set, get) => ({
49
49
  prevStep = ModalStep.AUTH_MAIN;
50
50
  }
51
51
  if (currentStep === ModalStep.EX_WALLET_SELECTED) {
52
- set({ selectedExternalWalletId: void 0, isExternalWalletConnecting: false, externalWalletError: void 0 });
52
+ set({ selectedExternalWallet: void 0, isExternalWalletConnecting: false, externalWalletError: void 0 });
53
53
  }
54
54
  if (prevStep) {
55
55
  set(__spreadValues({
@@ -107,7 +107,7 @@ const getActions = (set, get) => ({
107
107
  setIsFullyLoggedIn: (isFullyLoggedIn) => set({ isFullyLoggedIn }),
108
108
  setAccountAddFundTab: (accountAddFundTab) => set({ accountAddFundTab }),
109
109
  setGuestAddFundsTab: (guestAddFundsTab) => set({ guestAddFundsTab }),
110
- setSelectedExternalWalletId: (selectedExternalWalletId) => set({ selectedExternalWalletId }),
110
+ setSelectedExternalWallet: (selectedExternalWallet) => set({ selectedExternalWallet }),
111
111
  setIsExternalWalletConnecting: (isExternalWalletConnecting) => set({ isExternalWalletConnecting }),
112
112
  setExternalWalletError: (externalWalletError) => set({ externalWalletError }),
113
113
  setIsUsingMobileConnector: (isUsingMobileConnector) => set({ isUsingMobileConnector }),
@@ -30,7 +30,10 @@ interface ModalState {
30
30
  isFullyLoggedIn: boolean;
31
31
  accountAddFundTab?: AddFundsTabType;
32
32
  guestAddFundsTab?: AddFundsTabType;
33
- selectedExternalWalletId?: string;
33
+ selectedExternalWallet?: {
34
+ id: string;
35
+ type: TWalletType;
36
+ };
34
37
  isUsingMobileConnector?: boolean;
35
38
  isExternalWalletConnecting?: boolean;
36
39
  externalWalletError?: string[];
@@ -75,7 +78,10 @@ export interface ModalActions {
75
78
  setOnRampStep: (_: OnRampStep) => void;
76
79
  setIsFullyLoggedIn: (isFullyLoggedIn: boolean) => void;
77
80
  setAccountAddFundTab: (accountAddFundTab?: AddFundsTabType) => void;
78
- setSelectedExternalWalletId: (id?: string) => void;
81
+ setSelectedExternalWallet: (_?: {
82
+ id: string;
83
+ type: TWalletType;
84
+ }) => void;
79
85
  setIsUsingMobileConnector: (isUsingMobileConnector?: boolean) => void;
80
86
  setIsExternalWalletConnecting: (isExternalWalletConnecting: boolean) => void;
81
87
  setExternalWalletError: (externalWalletError?: string[]) => void;
@@ -61,7 +61,7 @@ const useModalStore = create()(
61
61
  step: state.step,
62
62
  authState: state.authState,
63
63
  onRampPurchase: state.onRampPurchase,
64
- selectedExternalWalletId: state.selectedExternalWalletId,
64
+ selectedExternalWallet: state.selectedExternalWallet,
65
65
  isUsingMobileConnector: state.isUsingMobileConnector,
66
66
  isPasskeySupported: state.isPasskeySupported
67
67
  })
@@ -1,5 +1,34 @@
1
+ import { TExternalWallet, TWalletType } from '@getpara/web-sdk';
2
+ import { ModalLinkAccountArgs } from '../../providers/AccountLinkProvider.js';
3
+ /**
4
+ * Arguments for linking accounts via modal
5
+ * @example
6
+ * // Open modal for user to select link type
7
+ * linkAccount()
8
+ *
9
+ * @example
10
+ * // Link with email
11
+ * linkAccount({ auth: { email: "user@example.com" } })
12
+ *
13
+ * @example
14
+ * // Link specific account type
15
+ * linkAccount({ type: "TWITTER" })
16
+ *
17
+ * @example
18
+ * // Link external wallet and allow user to select type
19
+ * linkAccount({ externalWallet: { provider: "METAMASK" } })
20
+ * OR
21
+ * // Link external wallet with specific type
22
+ * linkAccount({ externalWallet: { provider: "METAMASK", type: "EVM" } })
23
+ */
24
+ export type LinkAccountArgs = Omit<ModalLinkAccountArgs, 'externalWallet'> | {
25
+ externalWallet: {
26
+ provider: TExternalWallet;
27
+ type?: TWalletType;
28
+ };
29
+ } | undefined;
1
30
  export declare const useLinkAccount: () => {
2
- linkAccount: (_: import("../../providers/AccountLinkProvider.js").ModalLinkAccountArgs) => Promise<void>;
31
+ linkAccount: (args: LinkAccountArgs) => Promise<void>;
3
32
  error: string | null;
4
33
  status: import("@tanstack/query-core").MutationStatus;
5
34
  isPending: boolean;
@@ -4,7 +4,9 @@ import { useAccountLinking } from "../../providers/AccountLinkProvider.js";
4
4
  const useLinkAccount = () => {
5
5
  const { linkAccount, linkAccountError, linkAccountStatus } = useAccountLinking();
6
6
  return {
7
- linkAccount,
7
+ linkAccount: (args) => {
8
+ return linkAccount(args);
9
+ },
8
10
  error: linkAccountError,
9
11
  status: linkAccountStatus,
10
12
  isPending: linkAccountStatus === "pending",
@@ -1,9 +1,9 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { MutationStatus } from '@tanstack/react-query';
3
- import { AccountLinkError, AccountLinkInProgress as CoreAccountLinkInProgress, LinkedAccount, LinkedAccounts, SupportedAccountLinks, TelegramAuthResponse, TExternalWallet, TLinkedAccountType, Auth, InternalMethodParams } from '@getpara/web-sdk';
4
- import { TWalletType } from '@getpara/user-management-client';
3
+ import { AccountLinkError, AccountLinkInProgress as CoreAccountLinkInProgress, LinkedAccount, LinkedAccounts, SupportedAccountLinks, TelegramAuthResponse, TLinkedAccountType, Auth, InternalMethodParams } from '@getpara/web-sdk';
4
+ import { TExternalWallet, TWalletType } from '@getpara/user-management-client';
5
5
  type AccountLinkInProgress = Partial<CoreAccountLinkInProgress & {
6
- pendingWalletProvider?: TExternalWallet;
6
+ pendingWalletProvider?: string;
7
7
  pendingWalletType?: TWalletType;
8
8
  }>;
9
9
  export type ModalLinkAccountArgs = undefined | {
@@ -12,7 +12,7 @@ export type ModalLinkAccountArgs = undefined | {
12
12
  type: Exclude<TLinkedAccountType, 'EXTERNAL_WALLET'> | 'X';
13
13
  } | {
14
14
  externalWallet: {
15
- internalId: TExternalWallet;
15
+ provider: TExternalWallet | string;
16
16
  type?: TWalletType;
17
17
  };
18
18
  } | {
@@ -18,7 +18,7 @@ import { useExternalWallets } from "./ExternalWalletProvider.js";
18
18
  import { useInternalClient } from "../hooks/utils/useInternalClient.js";
19
19
  import { generateInternalMutation } from "../hooks/mutations/utils.js";
20
20
  import { validateAuth } from "../../modal/utils/authInputHelpers.js";
21
- import { extractAuthInfo } from "@getpara/user-management-client";
21
+ import { EXTERNAL_WALLET_TYPES, extractAuthInfo } from "@getpara/user-management-client";
22
22
  import { useStore } from "../stores/useStore.js";
23
23
  const AccountLinkContext = createContext({
24
24
  isEnabled: false,
@@ -119,6 +119,7 @@ const AccountLinkProvider = ({ children }) => {
119
119
  const [linkAccountError, setLinkAccountError] = useState(null);
120
120
  const [linkAccountStatus, setLinkAccountStatus] = useState("pending");
121
121
  const linkAccount = (args) => __async(void 0, null, function* () {
122
+ var _a2;
122
123
  if (!isEnabled) {
123
124
  setLinkAccountError(AccountLinkError.NotAuthenticated);
124
125
  throw new Error(AccountLinkError.NotAuthenticated);
@@ -138,9 +139,17 @@ const AccountLinkProvider = ({ children }) => {
138
139
  break;
139
140
  case (args && "externalWallet" in args):
140
141
  {
141
- const providerId = args.externalWallet.internalId;
142
+ const isSupportedWalletType = EXTERNAL_WALLET_TYPES.includes(args.externalWallet.provider);
143
+ let supportedWalletId;
144
+ if (isSupportedWalletType) {
145
+ supportedWalletId = (_a2 = wallets.find((w) => w.internalId === args.externalWallet.provider)) == null ? void 0 : _a2.id;
146
+ if (!supportedWalletId) {
147
+ throw new Error(`wallet not installed: ${args.externalWallet.provider}`);
148
+ }
149
+ }
150
+ const providerId = supportedWalletId != null ? supportedWalletId : args.externalWallet.provider;
142
151
  const type = args.externalWallet.type;
143
- if (providerId === (connectedWallet == null ? void 0 : connectedWallet.internalId)) {
152
+ if (providerId === (connectedWallet == null ? void 0 : connectedWallet.id)) {
144
153
  throw new Error(`Cannot link the currently connected external wallet: ${providerId}`);
145
154
  }
146
155
  setAccountLinkInProgress({
@@ -148,7 +157,7 @@ const AccountLinkProvider = ({ children }) => {
148
157
  pendingWalletProvider: providerId,
149
158
  pendingWalletType: type
150
159
  });
151
- const linkWallet = wallets.find((w) => w.internalId === providerId);
160
+ const linkWallet = wallets.find((w) => w.id === providerId);
152
161
  if (!linkWallet) {
153
162
  throw new Error(`wallet not installed: ${providerId}`);
154
163
  }
@@ -181,7 +190,7 @@ const AccountLinkProvider = ({ children }) => {
181
190
  setLinkAccountError(`Error authenticating external wallet: ${e.message}`);
182
191
  } finally {
183
192
  if (linkWallet.type === "EVM" || linkWallet.type === "SOLANA") {
184
- yield disconnectBase(providerId);
193
+ yield disconnectBase(providerId, linkWallet.type);
185
194
  }
186
195
  }
187
196
  }
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { TWalletType } from '@getpara/web-sdk';
3
- import { BalanceManagement, ChainManagement, CommonWallet, ExternalWalletContextType, TExternalWallet } from '@getpara/react-common';
3
+ import { BalanceManagement, ChainManagement, CommonWallet, ExternalWalletContextType } from '@getpara/react-common';
4
4
  import { ExternalWalletInfo, VerifyExternalWalletParams } from '@getpara/web-sdk';
5
5
  import { CosmosSignResult } from '@getpara/cosmos-wallet-connectors';
6
6
  export declare const useWalletDisplayHelpers: (wallet: CommonWallet | undefined) => {
@@ -31,11 +31,11 @@ export declare const defaultExternalWallet: {
31
31
  signMessage: () => Promise<any>;
32
32
  isSigningMessage: boolean;
33
33
  getWalletBalance: () => Promise<undefined>;
34
- requestInfo: (_: TExternalWallet) => Promise<ExternalWalletInfo>;
35
- disconnectBase: (_: TExternalWallet) => Promise<void>;
34
+ requestInfo: (_: string) => Promise<ExternalWalletInfo>;
35
+ disconnectBase: (_: string, __: TWalletType) => Promise<void>;
36
36
  connectFarcasterMiniApp: () => Promise<void>;
37
37
  };
38
- type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo'> & ChainManagement<string, void> & BalanceManagement & {
38
+ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo' | 'disconnectBase'> & ChainManagement<string, void> & BalanceManagement & {
39
39
  wallet?: CommonWallet;
40
40
  qrUri?: string;
41
41
  chainIdSwitchingTo?: string;
@@ -52,7 +52,8 @@ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 's
52
52
  connectEmbeddedToExternalConnectors: () => Promise<void>;
53
53
  isSigningMessage: boolean;
54
54
  verifyWalletSignature: () => Promise<VerifyExternalWalletParams | undefined>;
55
- requestInfo: (_: TExternalWallet, __: TWalletType) => Promise<ExternalWalletInfo>;
55
+ requestInfo: (_: string, __: TWalletType) => Promise<ExternalWalletInfo>;
56
+ disconnectBase: (_: string, __: TWalletType) => Promise<void>;
56
57
  connectFarcasterMiniApp: () => Promise<void>;
57
58
  };
58
59
  export declare const ExternalWalletContext: import("react").Context<Value>;
@@ -11,11 +11,6 @@ import { useStore } from "../stores/useStore.js";
11
11
  import { ModalStep } from "../../modal/index.js";
12
12
  import { useModalStore } from "../../modal/stores/index.js";
13
13
  import { useAccount, useModal, useParaStatus, useVerifyExternalWallet, useWalletState } from "../hooks/index.js";
14
- import {
15
- COSMOS_WALLETS,
16
- EVM_WALLETS,
17
- SOLANA_WALLETS
18
- } from "@getpara/web-sdk";
19
14
  import { useAuthActions } from "./AuthProvider.js";
20
15
  const useWalletDisplayHelpers = (wallet) => {
21
16
  const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
@@ -49,7 +44,7 @@ const defaultExternalWallet = {
49
44
  isSigningMessage: false,
50
45
  getWalletBalance: () => Promise.resolve(void 0),
51
46
  requestInfo: (_) => Promise.resolve({}),
52
- disconnectBase: (_) => Promise.resolve(),
47
+ disconnectBase: (_, __) => Promise.resolve(),
53
48
  connectFarcasterMiniApp: () => Promise.resolve()
54
49
  };
55
50
  const ExternalWalletContext = createContext(defaultExternalWallet);
@@ -107,8 +102,8 @@ function ExternalWalletProvider({ children }) {
107
102
  const setStepDirection = useModalStore((state) => state.setStepDirection);
108
103
  const setIsExternalWalletConnecting = useModalStore((state) => state.setIsExternalWalletConnecting);
109
104
  const isExternalWalletConnecting = useModalStore((state) => state.isExternalWalletConnecting);
110
- const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
111
- const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
105
+ const selectedExternalWallet = useModalStore((state) => state.selectedExternalWallet);
106
+ const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
112
107
  const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
113
108
  const setIsUsingMobileConnector = useModalStore((state) => state.setIsUsingMobileConnector);
114
109
  const refs = useModalStore((state) => state.refs);
@@ -119,14 +114,19 @@ function ExternalWalletProvider({ children }) {
119
114
  const [qrUri, setQrUri] = useState();
120
115
  const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
121
116
  const [isSigningMessage, setIsSigningMessage] = useState(false);
122
- const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter(
117
+ const allWallets = [...evmWallets, ...solanaWallets, ...cosmosWallets];
118
+ let wallets = allWallets.filter(
123
119
  (w) => (w.internalId !== "FARCASTER" || (para == null ? void 0 : para.isFarcasterMiniApp)) && externalWallets.includes(w.id.toUpperCase())
124
120
  ).sort(
125
121
  (a, b) => externalWallets.indexOf(a.id.toUpperCase()) - externalWallets.indexOf(b.id.toUpperCase())
126
122
  ).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
123
+ const injectedWallets = allWallets.filter(
124
+ (w) => (w == null ? void 0 : w.id) !== "Para" && !wallets.some((wallet2) => wallet2.id === w.id) && w.installed
125
+ );
126
+ wallets = [...wallets, ...injectedWallets];
127
127
  const wallet = useMemo(
128
- () => wallets.find((w) => w.internalId === selectedExternalWalletId),
129
- [wallets, selectedExternalWalletId]
128
+ () => wallets.find((w) => w.id === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.id) && w.type === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.type)),
129
+ [wallets, selectedExternalWallet]
130
130
  );
131
131
  const updateQrUri = () => __async(this, null, function* () {
132
132
  var _a;
@@ -153,7 +153,7 @@ function ExternalWalletProvider({ children }) {
153
153
  return void 0;
154
154
  }
155
155
  }
156
- }), [evmGetWalletBalance, selectedExternalWalletId]);
156
+ }), [evmGetWalletBalance, selectedExternalWallet]);
157
157
  const chains = useMemo(() => {
158
158
  var _a;
159
159
  const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
@@ -168,7 +168,7 @@ function ExternalWalletProvider({ children }) {
168
168
  return [];
169
169
  }
170
170
  }
171
- }, [cosmosChains, evmChains, selectedExternalWalletId]);
171
+ }, [cosmosChains, evmChains, selectedExternalWallet]);
172
172
  const chainId = useMemo(() => {
173
173
  var _a;
174
174
  const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
@@ -183,7 +183,7 @@ function ExternalWalletProvider({ children }) {
183
183
  return void 0;
184
184
  }
185
185
  }
186
- }, [cosmosChains, evmChains, selectedExternalWalletId]);
186
+ }, [cosmosChains, evmChains, selectedExternalWallet]);
187
187
  const switchChain = useCallback(
188
188
  (chainId2) => __async(this, null, function* () {
189
189
  var _a;
@@ -459,17 +459,12 @@ function ExternalWalletProvider({ children }) {
459
459
  }
460
460
  }
461
461
  });
462
- const disconnectBase = (providerId) => __async(this, null, function* () {
463
- const [isEvm, isSolana, _isCosmos] = [
464
- EVM_WALLETS.includes(providerId),
465
- SOLANA_WALLETS.includes(providerId),
466
- COSMOS_WALLETS.includes(providerId)
467
- ];
468
- switch (true) {
469
- case isEvm:
462
+ const disconnectBase = (providerId, type) => __async(this, null, function* () {
463
+ switch (type) {
464
+ case "EVM":
470
465
  yield evmDisconnectBase(providerId);
471
466
  break;
472
- case isSolana:
467
+ case "SOLANA":
473
468
  yield solanaDisconnectBase(providerId);
474
469
  break;
475
470
  default: {
@@ -482,7 +477,7 @@ function ExternalWalletProvider({ children }) {
482
477
  yield para.logout();
483
478
  yield evmDisconnect();
484
479
  yield cosmosDisconnect();
485
- setSelectedExternalWalletId();
480
+ setSelectedExternalWallet();
486
481
  yield solanaDisconnect();
487
482
  });
488
483
  const walletDisplayHelpers = useWalletDisplayHelpers(wallet);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.33",
3
+ "version": "2.0.0-alpha.34",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.33",
9
- "@getpara/react-components": "2.0.0-alpha.33",
10
- "@getpara/web-sdk": "2.0.0-alpha.33",
8
+ "@getpara/react-common": "2.0.0-alpha.34",
9
+ "@getpara/react-components": "2.0.0-alpha.34",
10
+ "@getpara/web-sdk": "2.0.0-alpha.34",
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.33",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.33",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.33",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.34",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.34",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.34",
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": "f338306fa30497d2190f8da2ff72ddd8d9d9032f",
41
+ "gitHead": "cff5cb1fa7284a850e688b20a6596d435315a475",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",