@getpara/react-sdk 2.0.0-alpha.21 → 2.0.0-alpha.23
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.
- package/dist/modal/components/Account/AccountProfileLink.js +6 -5
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +22 -9
- package/dist/modal/components/Body/Body.js +4 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +8 -3
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +13 -4
- package/dist/modal/components/common.js +7 -7
- package/dist/modal/constants/constants.d.ts +1 -1
- package/dist/modal/constants/constants.js +1 -1
- package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
- package/dist/modal/constants/walletTypeConfig.js +13 -0
- package/dist/modal/utils/steps.d.ts +3 -0
- package/dist/modal/utils/steps.js +6 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +1 -1
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +1 -1
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +1 -1
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +1 -1
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +1 -1
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +1 -1
- package/dist/provider/hooks/queries/utils.js +1 -1
- package/dist/provider/providers/AccountLinkProvider.d.ts +7 -2
- package/dist/provider/providers/AccountLinkProvider.js +12 -4
- package/dist/provider/providers/ExternalWalletProvider.d.ts +3 -1
- package/dist/provider/providers/ExternalWalletProvider.js +23 -28
- package/package.json +8 -8
|
@@ -19,7 +19,7 @@ import { ExternalWalletMobileConnect } from "../ExternalWalletStep/ExternalWalle
|
|
|
19
19
|
import { useResendVerificationCode } from "../../../provider/index.js";
|
|
20
20
|
import { AccountLinkError } from "@getpara/web-sdk";
|
|
21
21
|
function AccountProfileLink() {
|
|
22
|
-
var _a, _b;
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
23
|
const {
|
|
24
24
|
accountLinkInProgress,
|
|
25
25
|
verifyEmailOrPhoneLink,
|
|
@@ -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,
|
|
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", {
|
|
33
33
|
url,
|
|
34
34
|
status: telegramStatus,
|
|
35
35
|
isLoaded,
|
|
@@ -37,7 +37,7 @@ function AccountProfileLink() {
|
|
|
37
37
|
} = useTelegramLogin(
|
|
38
38
|
isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink } : { isActive: false }
|
|
39
39
|
), status = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.isComplete) ? "success" : isTelegram ? telegramStatus : linkAccountStatus, commonWallet = useMemo(() => {
|
|
40
|
-
const wallet = wallets.find((w) => w.internalId === externalWalletType);
|
|
40
|
+
const wallet = wallets.find((w) => w.internalId === externalWalletProvider && w.type === externalWalletType);
|
|
41
41
|
return wallet;
|
|
42
42
|
}, [wallets]), walletDisplayHelpers = useWalletDisplayHelpers(commonWallet);
|
|
43
43
|
const { upper, lower } = useMemo(() => {
|
|
@@ -71,7 +71,8 @@ function AccountProfileLink() {
|
|
|
71
71
|
text: message
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
|
-
|
|
74
|
+
``;
|
|
75
|
+
const onTryAgain = externalWalletProvider && externalWalletType ? () => linkAccount({ externalWallet: { internalId: externalWalletProvider, type: externalWalletType } }) : accountLinkType && accountLinkType !== "EXTERNAL_WALLET" ? () => linkAccount({ type: accountLinkType }) : void 0;
|
|
75
76
|
const tryAgain = onTryAgain ? /* @__PURE__ */ jsxs(CpslButton, { variant: "secondary", fullWidth: true, onClick: onTryAgain, children: [
|
|
76
77
|
/* @__PURE__ */ jsx(CpslIcon, { icon: "refresh", slot: "start" }),
|
|
77
78
|
"Try Again"
|
|
@@ -147,7 +148,7 @@ function AccountProfileLink() {
|
|
|
147
148
|
wallet: commonWallet,
|
|
148
149
|
isSelfFetching: true,
|
|
149
150
|
onConnectWc: (w) => __async(this, null, function* () {
|
|
150
|
-
yield linkAccount({ externalWallet: w.internalId });
|
|
151
|
+
yield linkAccount({ externalWallet: { internalId: w.internalId, type: w.type } });
|
|
151
152
|
})
|
|
152
153
|
}
|
|
153
154
|
);
|
|
@@ -30,19 +30,30 @@ function AccountProfileLinkOptions() {
|
|
|
30
30
|
...EXTERNAL_WALLET_TYPES,
|
|
31
31
|
...accountLinkOptions.slice(externalWalletIndex + 1)
|
|
32
32
|
] : accountLinkOptions;
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
return Array.from(
|
|
34
|
+
new Set(
|
|
35
|
+
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;
|
|
38
|
+
})) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
);
|
|
41
45
|
}, [accountLinkOptions, externalWalletIndex, wallets]);
|
|
42
46
|
useEffect(() => {
|
|
43
47
|
resetMutations();
|
|
44
48
|
setLinkAccountError(null);
|
|
45
49
|
}, []);
|
|
50
|
+
const getExternalWalletType = (internalId) => {
|
|
51
|
+
const allWallets = wallets.filter((wallet) => wallet.internalId === internalId);
|
|
52
|
+
if (allWallets.length === 1) {
|
|
53
|
+
return allWallets[0].type;
|
|
54
|
+
}
|
|
55
|
+
return void 0;
|
|
56
|
+
};
|
|
46
57
|
return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
47
58
|
(isEmail || isPhone) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
59
|
/* @__PURE__ */ jsx(
|
|
@@ -68,7 +79,9 @@ function AccountProfileLinkOptions() {
|
|
|
68
79
|
{
|
|
69
80
|
fullWidth: true,
|
|
70
81
|
variant: "tertiary",
|
|
71
|
-
onClick: () => linkAccount(
|
|
82
|
+
onClick: () => linkAccount(
|
|
83
|
+
isWallet ? { externalWallet: { internalId: option, type: getExternalWalletType(option) } } : { type: option }
|
|
84
|
+
),
|
|
72
85
|
children: [
|
|
73
86
|
/* @__PURE__ */ jsx(AccountTypeIcon, { accountType: option, size: "24px" }),
|
|
74
87
|
/* @__PURE__ */ jsx(CpslText, { color: "contrast", variant: "bodyM", children: getAccountTypeName(option) })
|
|
@@ -42,6 +42,7 @@ import { AccountProfile } from "../Account/AccountProfile.js";
|
|
|
42
42
|
import { AccountProfileLinkOptions } from "../Account/AccountProfileLinkOptions.js";
|
|
43
43
|
import { AccountProfileLink } from "../Account/AccountProfileLink.js";
|
|
44
44
|
import { AccountProfileUnlink } from "../Account/AccountProfileUnlink.js";
|
|
45
|
+
import { ExternalWalletNetworkSelectStep } from "../ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js";
|
|
45
46
|
const MIN_HEIGHT = {
|
|
46
47
|
[ModalStep.ADD_FUNDS_AWAITING]: "680px"
|
|
47
48
|
};
|
|
@@ -188,6 +189,9 @@ const Body = ({
|
|
|
188
189
|
case ModalStep.CHAIN_SWITCH: {
|
|
189
190
|
return /* @__PURE__ */ jsx(ChainSwitch, {});
|
|
190
191
|
}
|
|
192
|
+
case ModalStep.EX_WALLET_NETWORK_SELECT: {
|
|
193
|
+
return /* @__PURE__ */ jsx(ExternalWalletNetworkSelectStep, {});
|
|
194
|
+
}
|
|
191
195
|
default: {
|
|
192
196
|
if (IFrameSteps.includes(currentStep)) {
|
|
193
197
|
return null;
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExternalWalletNetworkSelectStep: () => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { safeStyled } from "@getpara/react-common";
|
|
5
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
6
|
+
import { useModalStore } from "../../stores/index.js";
|
|
7
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
8
|
+
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
9
|
+
import { WALLET_TYPE_CONFIG } from "../../constants/walletTypeConfig.js";
|
|
10
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
11
|
+
const ExternalWalletNetworkSelectStep = () => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
14
|
+
const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
|
|
15
|
+
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
16
|
+
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
17
|
+
const { accountLinkInProgress, linkAccount } = useAccountLinking();
|
|
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) {
|
|
20
|
+
setStep(ModalStep.ACCOUNT_MAIN);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const availableWallets = wallets.filter((w) => w.internalId === (externalWalletProvider != null ? externalWalletProvider : selectedExternalWalletId));
|
|
24
|
+
const firstWallet = availableWallets[0];
|
|
25
|
+
const handleWalletClick = (wallet) => () => {
|
|
26
|
+
if (accountLinkInProgress) {
|
|
27
|
+
linkAccount({ externalWallet: wallet });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setSelectedExternalWalletId(wallet.internalId);
|
|
31
|
+
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
32
|
+
if (wallet.installed) {
|
|
33
|
+
connectExternalWallet(wallet);
|
|
34
|
+
} else if (wallet.isMobile) {
|
|
35
|
+
connectExternalWallet(wallet, true);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(Avatar, { slot: "image", src: firstWallet == null ? void 0 : firstWallet.iconUrl }),
|
|
40
|
+
/* @__PURE__ */ jsx(ButtonContainer, { children: availableWallets.map((wallet) => {
|
|
41
|
+
const config = WALLET_TYPE_CONFIG[wallet.type];
|
|
42
|
+
return /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleWalletClick(wallet), children: /* @__PURE__ */ jsxs(ButtonInnerContainer, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: config.icon }),
|
|
44
|
+
/* @__PURE__ */ jsx(CpslText, { weight: "medium", children: config.name })
|
|
45
|
+
] }) }, wallet.type);
|
|
46
|
+
}) })
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
49
|
+
const Container = safeStyled.div`
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 32px;
|
|
54
|
+
`;
|
|
55
|
+
const ButtonContainer = safeStyled.div`
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 8px;
|
|
61
|
+
`;
|
|
62
|
+
const Avatar = safeStyled.img`
|
|
63
|
+
width: 80px;
|
|
64
|
+
height: 80px;
|
|
65
|
+
object-fit: contain;
|
|
66
|
+
`;
|
|
67
|
+
const ButtonInnerContainer = safeStyled.div`
|
|
68
|
+
width: 100%;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 8px;
|
|
72
|
+
`;
|
|
73
|
+
export {
|
|
74
|
+
ExternalWalletNetworkSelectStep
|
|
75
|
+
};
|
package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js
CHANGED
|
@@ -2,16 +2,21 @@
|
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { CpslButton, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
5
|
-
import { useEffect } from "react";
|
|
6
5
|
import { safeStyled } from "@getpara/react-common";
|
|
7
6
|
import { useModalStore } from "../../stores/index.js";
|
|
8
7
|
import { ErrorContainer, ErrorIcon, Heading, InnerStepContainer, StepContainer } from "../common.js";
|
|
9
8
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
9
|
+
import { useEffect, useRef } from "react";
|
|
10
10
|
const ExternalWalletVerificationStep = () => {
|
|
11
|
+
const effectRan = useRef(false);
|
|
11
12
|
const { isExternalWalletVerifying, verifyWalletSignature } = useExternalWallets();
|
|
12
13
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
13
14
|
useEffect(() => {
|
|
14
|
-
|
|
15
|
+
const hasRun = effectRan.current;
|
|
16
|
+
if (!hasRun) {
|
|
17
|
+
verifyWalletSignature();
|
|
18
|
+
effectRan.current = true;
|
|
19
|
+
}
|
|
15
20
|
}, []);
|
|
16
21
|
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
17
22
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
@@ -22,7 +27,7 @@ const ExternalWalletVerificationStep = () => {
|
|
|
22
27
|
/* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: externalWalletError == null ? void 0 : externalWalletError[0] })
|
|
23
28
|
] })
|
|
24
29
|
] }),
|
|
25
|
-
/* @__PURE__ */ jsx(InnerStepContainer, { children: isExternalWalletVerifying ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(CpslButton, { onClick: verifyWalletSignature, children: "Retry" }) })
|
|
30
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: isExternalWalletVerifying || !effectRan.current ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(CpslButton, { onClick: verifyWalletSignature, children: "Retry" }) })
|
|
26
31
|
] });
|
|
27
32
|
};
|
|
28
33
|
const InlineText = safeStyled(CpslText)`
|
|
@@ -13,14 +13,17 @@ import { hasEmbeddedAuth } from "../../utils/authLayoutHelpers.js";
|
|
|
13
13
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
14
14
|
const HAS_MORE_LENGTH = 3;
|
|
15
15
|
const ExternalWallets = () => {
|
|
16
|
-
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
16
|
+
const { wallets: allWallets, connectExternalWallet } = useExternalWallets();
|
|
17
17
|
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
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);
|
|
21
21
|
const [search, setSearch] = useState("");
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const dedupedWallets = Array.from(new Set(allWallets.map((wallet) => wallet.id))).map((id) => {
|
|
23
|
+
return allWallets.find((wallet) => wallet.id === id);
|
|
24
|
+
});
|
|
25
|
+
const hasMore = dedupedWallets.length > HAS_MORE_LENGTH;
|
|
26
|
+
const walletsToShow = showAll || !hasMore ? search ? dedupedWallets.filter((w) => w.name.toLowerCase().includes(search.toLowerCase())) : dedupedWallets : dedupedWallets.slice(0, HAS_MORE_LENGTH);
|
|
24
27
|
const showMoreButton = !showAll && hasMore;
|
|
25
28
|
const handleShowAll = () => {
|
|
26
29
|
setStep(ModalStep.EX_WALLET_MORE);
|
|
@@ -29,7 +32,13 @@ const ExternalWallets = () => {
|
|
|
29
32
|
setStep(ModalStep.AUTH_MORE);
|
|
30
33
|
};
|
|
31
34
|
const handleWalletClick = (wallet) => () => {
|
|
32
|
-
|
|
35
|
+
const shouldShowNetworkSelection = allWallets.filter((w) => w.id === wallet.id).length > 1;
|
|
36
|
+
if (shouldShowNetworkSelection) {
|
|
37
|
+
setSelectedExternalWalletId(wallet.internalId);
|
|
38
|
+
setStep(ModalStep.EX_WALLET_NETWORK_SELECT);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setSelectedExternalWalletId(wallet.internalId);
|
|
33
42
|
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
34
43
|
if (wallet.installed) {
|
|
35
44
|
connectExternalWallet(wallet);
|
|
@@ -199,10 +199,10 @@ function GradientScroll({ height, gap, children }) {
|
|
|
199
199
|
GradientScrollContainer,
|
|
200
200
|
{
|
|
201
201
|
ref,
|
|
202
|
-
height,
|
|
203
|
-
gap,
|
|
204
|
-
isNotAtBottom,
|
|
205
|
-
isNotAtTop,
|
|
202
|
+
$height: height,
|
|
203
|
+
$gap: gap,
|
|
204
|
+
$isNotAtBottom: isNotAtBottom,
|
|
205
|
+
$isNotAtTop: isNotAtTop,
|
|
206
206
|
onScroll,
|
|
207
207
|
children: /* @__PURE__ */ jsx("div", { children })
|
|
208
208
|
}
|
|
@@ -212,16 +212,16 @@ const HeroGenericIcon = ({ accountType }) => {
|
|
|
212
212
|
return /* @__PURE__ */ jsx(Avatar, { children: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "24px" }) });
|
|
213
213
|
};
|
|
214
214
|
const GradientScrollContainer = safeStyled.div`
|
|
215
|
-
max-height: ${({ height }) => height || "100%"};
|
|
215
|
+
max-height: ${({ $height }) => $height || "100%"};
|
|
216
216
|
width: 100%;
|
|
217
217
|
overflow-y: auto;
|
|
218
|
-
mask-image: ${({ isNotAtBottom, isNotAtTop }) => isNotAtBottom && isNotAtTop ? "linear-gradient(to bottom, transparent 0%, black 24px, black calc(100% - 24px), transparent 100%)" : isNotAtBottom ? "linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)" : isNotAtTop ? "linear-gradient(to top, black calc(100% - 24px), transparent 100%)" : "none"};
|
|
218
|
+
mask-image: ${({ $isNotAtBottom, $isNotAtTop }) => $isNotAtBottom && $isNotAtTop ? "linear-gradient(to bottom, transparent 0%, black 24px, black calc(100% - 24px), transparent 100%)" : $isNotAtBottom ? "linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)" : $isNotAtTop ? "linear-gradient(to top, black calc(100% - 24px), transparent 100%)" : "none"};
|
|
219
219
|
|
|
220
220
|
& > div {
|
|
221
221
|
width: 100%;
|
|
222
222
|
display: flex;
|
|
223
223
|
flex-direction: column;
|
|
224
|
-
gap: ${({ gap }) => gap || "8px"};
|
|
224
|
+
gap: ${({ $gap }) => $gap || "8px"};
|
|
225
225
|
}
|
|
226
226
|
`;
|
|
227
227
|
const Avatar = safeStyled.div`
|
|
@@ -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" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "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" | "solana" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "userPlus" | "user" | "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" | "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" | "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;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
const WALLET_TYPE_CONFIG = {
|
|
4
|
+
EVM: {
|
|
5
|
+
name: "Ethereum",
|
|
6
|
+
icon: "ethCircle"
|
|
7
|
+
},
|
|
8
|
+
SOLANA: { name: "Solana", icon: "solanaCircle" },
|
|
9
|
+
COSMOS: { name: "Cosmos", icon: "cosmosCircle" }
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
WALLET_TYPE_CONFIG
|
|
13
|
+
};
|
|
@@ -6,6 +6,7 @@ export declare enum ModalStep {
|
|
|
6
6
|
AWAITING_GUEST_WALLET_CREATION = "AWAITING_GUEST_WALLET_CREATION",
|
|
7
7
|
EX_WALLET_MORE = "EX_WALLET_MORE",
|
|
8
8
|
EX_WALLET_SELECTED = "EX_WALLET_SELECTED",
|
|
9
|
+
EX_WALLET_NETWORK_SELECT = "EX_WALLET_NETWORK_SELECT",
|
|
9
10
|
VERIFICATIONS = "VERIFICATIONS",
|
|
10
11
|
EXTERNAL_WALLET_VERIFICATION = "EXTERNAL_WALLET_VERIFICATION",
|
|
11
12
|
AWAITING_OAUTH = "AWAITING_OAUTH",
|
|
@@ -67,6 +68,7 @@ declare enum SignUpModalStep {
|
|
|
67
68
|
AUTH_MORE = "AUTH_MORE",
|
|
68
69
|
EX_WALLET_MORE = "EX_WALLET_MORE",
|
|
69
70
|
EX_WALLET_SELECTED = "EX_WALLET_SELECTED",
|
|
71
|
+
EX_WALLET_NETWORK_SELECT = "EX_WALLET_NETWORK_SELECT",
|
|
70
72
|
VERIFICATIONS = "VERIFICATIONS",
|
|
71
73
|
EXTERNAL_WALLET_VERIFICATION = "EXTERNAL_WALLET_VERIFICATION",
|
|
72
74
|
AWAITING_OAUTH = "AWAITING_OAUTH",
|
|
@@ -100,6 +102,7 @@ declare enum LoginModalStep {
|
|
|
100
102
|
AUTH_MORE = "AUTH_MORE",
|
|
101
103
|
EX_WALLET_MORE = "EX_WALLET_MORE",
|
|
102
104
|
EX_WALLET_SELECTED = "EX_WALLET_SELECTED",
|
|
105
|
+
EX_WALLET_NETWORK_SELECT = "EX_WALLET_NETWORK_SELECT",
|
|
103
106
|
AWAITING_OAUTH = "AWAITING_OAUTH",
|
|
104
107
|
FARCASTER_OAUTH = "FARCASTER_OAUTH",
|
|
105
108
|
TELEGRAM_OAUTH = "TELEGRAM_OAUTH",
|
|
@@ -7,6 +7,7 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
|
|
|
7
7
|
ModalStep2["AWAITING_GUEST_WALLET_CREATION"] = "AWAITING_GUEST_WALLET_CREATION";
|
|
8
8
|
ModalStep2["EX_WALLET_MORE"] = "EX_WALLET_MORE";
|
|
9
9
|
ModalStep2["EX_WALLET_SELECTED"] = "EX_WALLET_SELECTED";
|
|
10
|
+
ModalStep2["EX_WALLET_NETWORK_SELECT"] = "EX_WALLET_NETWORK_SELECT";
|
|
10
11
|
ModalStep2["VERIFICATIONS"] = "VERIFICATIONS";
|
|
11
12
|
ModalStep2["EXTERNAL_WALLET_VERIFICATION"] = "EXTERNAL_WALLET_VERIFICATION";
|
|
12
13
|
ModalStep2["AWAITING_OAUTH"] = "AWAITING_OAUTH";
|
|
@@ -60,6 +61,7 @@ var AccountStep = /* @__PURE__ */ ((AccountStep2) => {
|
|
|
60
61
|
const RESET_TO_AUTH_STEPS = [
|
|
61
62
|
"EX_WALLET_MORE" /* EX_WALLET_MORE */,
|
|
62
63
|
"EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */,
|
|
64
|
+
"EX_WALLET_NETWORK_SELECT" /* EX_WALLET_NETWORK_SELECT */,
|
|
63
65
|
"VERIFICATIONS" /* VERIFICATIONS */,
|
|
64
66
|
"EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */,
|
|
65
67
|
"AWAITING_OAUTH" /* AWAITING_OAUTH */,
|
|
@@ -115,6 +117,7 @@ var SignUpModalStep = /* @__PURE__ */ ((SignUpModalStep2) => {
|
|
|
115
117
|
SignUpModalStep2["AUTH_MORE"] = "AUTH_MORE";
|
|
116
118
|
SignUpModalStep2["EX_WALLET_MORE"] = "EX_WALLET_MORE";
|
|
117
119
|
SignUpModalStep2["EX_WALLET_SELECTED"] = "EX_WALLET_SELECTED";
|
|
120
|
+
SignUpModalStep2["EX_WALLET_NETWORK_SELECT"] = "EX_WALLET_NETWORK_SELECT";
|
|
118
121
|
SignUpModalStep2["VERIFICATIONS"] = "VERIFICATIONS";
|
|
119
122
|
SignUpModalStep2["EXTERNAL_WALLET_VERIFICATION"] = "EXTERNAL_WALLET_VERIFICATION";
|
|
120
123
|
SignUpModalStep2["AWAITING_OAUTH"] = "AWAITING_OAUTH";
|
|
@@ -143,6 +146,7 @@ const SignUpPreviousStep = {
|
|
|
143
146
|
["AUTH_MORE" /* AUTH_MORE */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
144
147
|
["EX_WALLET_MORE" /* EX_WALLET_MORE */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
145
148
|
["EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
149
|
+
["EX_WALLET_NETWORK_SELECT" /* EX_WALLET_NETWORK_SELECT */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
146
150
|
["VERIFICATIONS" /* VERIFICATIONS */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
147
151
|
["EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
148
152
|
["AWAITING_OAUTH" /* AWAITING_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
@@ -179,6 +183,7 @@ var LoginModalStep = /* @__PURE__ */ ((LoginModalStep2) => {
|
|
|
179
183
|
LoginModalStep2["AUTH_MORE"] = "AUTH_MORE";
|
|
180
184
|
LoginModalStep2["EX_WALLET_MORE"] = "EX_WALLET_MORE";
|
|
181
185
|
LoginModalStep2["EX_WALLET_SELECTED"] = "EX_WALLET_SELECTED";
|
|
186
|
+
LoginModalStep2["EX_WALLET_NETWORK_SELECT"] = "EX_WALLET_NETWORK_SELECT";
|
|
182
187
|
LoginModalStep2["AWAITING_OAUTH"] = "AWAITING_OAUTH";
|
|
183
188
|
LoginModalStep2["FARCASTER_OAUTH"] = "FARCASTER_OAUTH";
|
|
184
189
|
LoginModalStep2["TELEGRAM_OAUTH"] = "TELEGRAM_OAUTH";
|
|
@@ -206,6 +211,7 @@ const LoginPreviousStep = {
|
|
|
206
211
|
["AUTH_MORE" /* AUTH_MORE */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
207
212
|
["EX_WALLET_MORE" /* EX_WALLET_MORE */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
208
213
|
["EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
214
|
+
["EX_WALLET_NETWORK_SELECT" /* EX_WALLET_NETWORK_SELECT */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
209
215
|
["TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
210
216
|
["AWAITING_OAUTH" /* AWAITING_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
211
217
|
["FARCASTER_OAUTH" /* FARCASTER_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CosmosExternalWalletContextType } from '@getpara/cosmos-wallet-connectors';
|
|
1
|
+
import { type CosmosExternalWalletContextType } from '@getpara/cosmos-wallet-connectors';
|
|
2
2
|
export declare const CosmosExternalWalletContext: import("react").Context<CosmosExternalWalletContextType>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { defaultCosmosExternalWallet } from "@getpara/
|
|
3
|
+
import { defaultCosmosExternalWallet } from "@getpara/react-common";
|
|
4
4
|
import { createContext } from "react";
|
|
5
5
|
const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
|
|
6
6
|
export {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
|
|
1
|
+
import { type EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
|
|
2
2
|
export declare const EvmExternalWalletContext: import("react").Context<EvmExternalWalletContextType>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { createContext } from "react";
|
|
4
|
-
import { defaultEvmExternalWallet } from "@getpara/
|
|
4
|
+
import { defaultEvmExternalWallet } from "@getpara/react-common";
|
|
5
5
|
const EvmExternalWalletContext = createContext(defaultEvmExternalWallet);
|
|
6
6
|
export {
|
|
7
7
|
EvmExternalWalletContext
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SolanaExternalWalletContextType } from '@getpara/solana-wallet-connectors';
|
|
1
|
+
import { type SolanaExternalWalletContextType } from '@getpara/solana-wallet-connectors';
|
|
2
2
|
export declare const SolanaExternalWalletContext: import("react").Context<SolanaExternalWalletContextType>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { createContext } from "react";
|
|
4
|
-
import { defaultSolanaExternalWallet } from "@getpara/
|
|
4
|
+
import { defaultSolanaExternalWallet } from "@getpara/react-common";
|
|
5
5
|
const SolanaExternalWalletContext = createContext(defaultSolanaExternalWallet);
|
|
6
6
|
export {
|
|
7
7
|
SolanaExternalWalletContext
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { MutationStatus } from '@tanstack/react-query';
|
|
3
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';
|
|
4
5
|
type AccountLinkInProgress = Partial<CoreAccountLinkInProgress & {
|
|
5
|
-
|
|
6
|
+
pendingWalletProvider?: TExternalWallet;
|
|
7
|
+
pendingWalletType?: TWalletType;
|
|
6
8
|
}>;
|
|
7
9
|
export type ModalLinkAccountArgs = undefined | {
|
|
8
10
|
auth: Auth<'email' | 'phone'>;
|
|
9
11
|
} | {
|
|
10
12
|
type: Exclude<TLinkedAccountType, 'EXTERNAL_WALLET'> | 'X';
|
|
11
13
|
} | {
|
|
12
|
-
externalWallet:
|
|
14
|
+
externalWallet: {
|
|
15
|
+
internalId: TExternalWallet;
|
|
16
|
+
type?: TWalletType;
|
|
17
|
+
};
|
|
13
18
|
} | {
|
|
14
19
|
options: SupportedAccountLinks;
|
|
15
20
|
};
|
|
@@ -137,18 +137,26 @@ const AccountLinkProvider = ({ children }) => {
|
|
|
137
137
|
break;
|
|
138
138
|
case (args && "externalWallet" in args):
|
|
139
139
|
{
|
|
140
|
-
const providerId = args.externalWallet;
|
|
140
|
+
const providerId = args.externalWallet.internalId;
|
|
141
|
+
const type = args.externalWallet.type;
|
|
141
142
|
if (providerId === (connectedWallet == null ? void 0 : connectedWallet.internalId)) {
|
|
142
143
|
throw new Error(`Cannot link the currently connected external wallet: ${providerId}`);
|
|
143
144
|
}
|
|
144
|
-
setAccountLinkInProgress({
|
|
145
|
+
setAccountLinkInProgress({
|
|
146
|
+
type: "EXTERNAL_WALLET",
|
|
147
|
+
pendingWalletProvider: providerId,
|
|
148
|
+
pendingWalletType: type
|
|
149
|
+
});
|
|
145
150
|
const linkWallet = wallets.find((w) => w.internalId === providerId);
|
|
146
151
|
if (!linkWallet) {
|
|
147
152
|
throw new Error(`wallet not installed: ${providerId}`);
|
|
148
153
|
}
|
|
149
|
-
openModal({ step: ModalStep.ACCOUNT_PROFILE_ADD });
|
|
154
|
+
openModal({ step: !type ? ModalStep.EX_WALLET_NETWORK_SELECT : ModalStep.ACCOUNT_PROFILE_ADD });
|
|
155
|
+
if (!type) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
150
158
|
try {
|
|
151
|
-
const externalWallet = yield externalWalletRequestInfo(providerId);
|
|
159
|
+
const externalWallet = yield externalWalletRequestInfo(providerId, type);
|
|
152
160
|
const accountLinkInProgress2 = yield mutateLinkAccountAsync({ externalWallet });
|
|
153
161
|
yield onAccountLinked(accountLinkInProgress2);
|
|
154
162
|
const signatureVerificationMessage = accountLinkInProgress2.externalWallet.signatureVerificationMessage;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TWalletType } from '@getpara/web-sdk';
|
|
2
3
|
import { BalanceManagement, ChainManagement, CommonWallet, ExternalWalletContextType, TExternalWallet } from '@getpara/react-common';
|
|
3
4
|
import { ExternalWalletInfo, VerifyExternalWalletParams } from '@getpara/web-sdk';
|
|
4
5
|
import { CosmosSignResult } from '@getpara/cosmos-wallet-connectors';
|
|
@@ -34,7 +35,7 @@ export declare const defaultExternalWallet: {
|
|
|
34
35
|
requestInfo: (_: TExternalWallet) => Promise<ExternalWalletInfo>;
|
|
35
36
|
disconnectBase: (_: TExternalWallet) => Promise<void>;
|
|
36
37
|
};
|
|
37
|
-
type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage'> & ChainManagement<string, void> & BalanceManagement & {
|
|
38
|
+
type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo'> & ChainManagement<string, void> & BalanceManagement & {
|
|
38
39
|
wallet?: CommonWallet;
|
|
39
40
|
qrUri?: string;
|
|
40
41
|
chainIdSwitchingTo?: string;
|
|
@@ -52,6 +53,7 @@ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 's
|
|
|
52
53
|
isSigningMessage: boolean;
|
|
53
54
|
verifyWalletSignature: () => Promise<VerifyExternalWalletParams | undefined>;
|
|
54
55
|
isExternalWalletVerifying?: boolean;
|
|
56
|
+
requestInfo: (_: TExternalWallet, __: TWalletType) => Promise<ExternalWalletInfo>;
|
|
55
57
|
};
|
|
56
58
|
export declare const ExternalWalletContext: import("react").Context<Value>;
|
|
57
59
|
export declare function ExternalWalletProvider({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
@@ -108,7 +108,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
108
108
|
const para = useInternalClient();
|
|
109
109
|
const { setSelectedWallet } = useWalletState();
|
|
110
110
|
const { onNewAuthState } = useAuthActions();
|
|
111
|
-
const {
|
|
111
|
+
const { mutateAsync: verifyExternalWallet } = useVerifyExternalWallet();
|
|
112
112
|
const [qrUri, setQrUri] = useState();
|
|
113
113
|
const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
|
|
114
114
|
const [isExternalWalletVerifying, setIsExternalWalletVerifying] = useState(false);
|
|
@@ -116,7 +116,10 @@ function ExternalWalletProvider({ children }) {
|
|
|
116
116
|
const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter((w) => externalWallets.includes(w.id.toUpperCase())).sort(
|
|
117
117
|
(a, b) => externalWallets.indexOf(a.id.toUpperCase()) - externalWallets.indexOf(b.id.toUpperCase())
|
|
118
118
|
).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
|
|
119
|
-
const wallet = useMemo(
|
|
119
|
+
const wallet = useMemo(
|
|
120
|
+
() => wallets.find((w) => w.internalId === selectedExternalWalletId),
|
|
121
|
+
[wallets, selectedExternalWalletId]
|
|
122
|
+
);
|
|
120
123
|
const updateQrUri = () => __async(this, null, function* () {
|
|
121
124
|
var _a;
|
|
122
125
|
const uri = yield (_a = wallet == null ? void 0 : wallet.getQrUri) == null ? void 0 : _a.call(wallet);
|
|
@@ -209,6 +212,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
209
212
|
[evmSwitchChain, cosmosSwitchChain]
|
|
210
213
|
);
|
|
211
214
|
const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
|
|
215
|
+
var _a;
|
|
212
216
|
setExternalWalletError();
|
|
213
217
|
setIsExternalWalletVerifying(true);
|
|
214
218
|
const wallet2 = Object.values(para.externalWallets)[0];
|
|
@@ -285,23 +289,19 @@ function ExternalWalletProvider({ children }) {
|
|
|
285
289
|
console.error("No signature or address found on the verifyWalletSignature response.");
|
|
286
290
|
return;
|
|
287
291
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
onError: (e) => {
|
|
298
|
-
console.error("Error verifying signature:", e);
|
|
299
|
-
setExternalWalletError(["Signature verification failed."]);
|
|
300
|
-
},
|
|
301
|
-
onSettled: () => {
|
|
302
|
-
setIsExternalWalletVerifying(false);
|
|
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);
|
|
303
298
|
}
|
|
304
|
-
})
|
|
299
|
+
} catch (e) {
|
|
300
|
+
console.error("Error verifying signature:", e);
|
|
301
|
+
setExternalWalletError(["Signature verification failed."]);
|
|
302
|
+
} finally {
|
|
303
|
+
setIsExternalWalletVerifying(false);
|
|
304
|
+
}
|
|
305
305
|
return verifyExternalWalletParams;
|
|
306
306
|
}
|
|
307
307
|
setIsExternalWalletVerifying(false);
|
|
@@ -397,22 +397,17 @@ function ExternalWalletProvider({ children }) {
|
|
|
397
397
|
}),
|
|
398
398
|
[isExternalWalletConnecting, externalWalletsWithFullAuth, connectionOnly, includeWalletVerification]
|
|
399
399
|
);
|
|
400
|
-
const requestInfo = (providerId) => __async(this, null, function* () {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
SOLANA_WALLETS.includes(providerId),
|
|
404
|
-
COSMOS_WALLETS.includes(providerId)
|
|
405
|
-
];
|
|
406
|
-
switch (true) {
|
|
407
|
-
case isEvm: {
|
|
400
|
+
const requestInfo = (providerId, type) => __async(this, null, function* () {
|
|
401
|
+
switch (type) {
|
|
402
|
+
case "EVM": {
|
|
408
403
|
const externalWallet = yield evmRequestInfo(providerId);
|
|
409
404
|
return externalWallet;
|
|
410
405
|
}
|
|
411
|
-
case
|
|
406
|
+
case "SOLANA": {
|
|
412
407
|
const externalWallet = yield solanaRequestInfo(providerId);
|
|
413
408
|
return externalWallet;
|
|
414
409
|
}
|
|
415
|
-
|
|
410
|
+
case "COSMOS": {
|
|
416
411
|
const externalWallet = yield cosmosRequestInfo(providerId);
|
|
417
412
|
return externalWallet;
|
|
418
413
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"*.css"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
19
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
20
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
18
|
+
"@getpara/react-common": "2.0.0-alpha.23",
|
|
19
|
+
"@getpara/react-components": "2.0.0-alpha.23",
|
|
20
|
+
"@getpara/web-sdk": "2.0.0-alpha.23",
|
|
21
21
|
"date-fns": "^3.6.0",
|
|
22
22
|
"framer-motion": "11.3.28",
|
|
23
23
|
"libphonenumber-js": "^1.11.1",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"cli": "node ./dist/cli/cli.mjs"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.
|
|
37
|
-
"@getpara/evm-wallet-connectors": "2.0.0-alpha.
|
|
38
|
-
"@getpara/solana-wallet-connectors": "2.0.0-alpha.
|
|
36
|
+
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.23",
|
|
37
|
+
"@getpara/evm-wallet-connectors": "2.0.0-alpha.23",
|
|
38
|
+
"@getpara/solana-wallet-connectors": "2.0.0-alpha.23",
|
|
39
39
|
"@testing-library/dom": "^10.4.0",
|
|
40
40
|
"@testing-library/react": "^16.3.0",
|
|
41
41
|
"@testing-library/react-hooks": "^8.0.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"resolutions": {
|
|
64
64
|
"styled-components": "^6"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "e7c7e95f79bcfca4d57a80f4dd721dc5ecaff24d"
|
|
67
67
|
}
|