@getpara/react-common 2.0.0-alpha.5 → 2.0.0-alpha.50
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/classes/ParaInternal.d.ts +14 -4
- package/dist/classes/ParaInternal.js +15 -1
- package/dist/components/HeroSpinner.d.ts +4 -3
- package/dist/components/HeroSpinner.js +28 -14
- package/dist/components/KnownDevices.js +5 -6
- package/dist/components/MoonPayEmbed.d.ts +4 -2
- package/dist/components/MoonPayEmbed.js +56 -83
- package/dist/components/NetworkSpeedBanner.js +5 -5
- package/dist/components/QRCode.js +7 -7
- package/dist/components/RampEmbed.d.ts +2 -2
- package/dist/components/RampEmbed.js +15 -27
- package/dist/components/UserIdentifier.d.ts +8 -0
- package/dist/components/UserIdentifier.js +30 -22
- package/dist/components/common.d.ts +3 -3
- package/dist/components/common.js +7 -7
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/constants/externalWalletDefaults.d.ts +47 -0
- package/dist/constants/externalWalletDefaults.js +49 -0
- package/dist/constants/oAuthLogos.d.ts +12 -0
- package/dist/constants/oAuthLogos.js +160 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useUserAgent.d.ts +2 -0
- package/dist/hooks/useUserAgent.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types/commonTypes.d.ts +15 -0
- package/dist/types/commonTypes.js +1 -0
- package/dist/types/externalWalletCommon.d.ts +69 -37
- package/dist/types/externalWalletCommon.js +0 -31
- package/dist/types/index.d.ts +8 -5
- package/dist/types/index.js +1 -0
- package/dist/utils/formatBiometricHints.d.ts +1 -1
- package/dist/utils/formatBiometricHints.js +2 -2
- package/dist/utils/getExternalWalletDisplayName.d.ts +3 -1
- package/dist/utils/getExternalWalletDisplayName.js +6 -14
- package/dist/utils/getExternalWalletIcon.d.ts +5 -0
- package/dist/utils/getExternalWalletIcon.js +17 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/safeStyled.d.ts +2 -0
- package/dist/utils/safeStyled.js +25 -0
- package/package.json +22 -24
- package/dist/components/StripeEmbed.d.ts +0 -4
- package/dist/components/StripeEmbed.js +0 -138
- package/dist/utils/offRampSend.d.ts +0 -7
- package/dist/utils/offRampSend.js +0 -75
|
@@ -1,39 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-GOCCUU3Z.js";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { CpslAvatar, CpslIcon, CpslText } from "@getpara/react-components";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { authType, identifier, externalWallet } = authInfo;
|
|
7
|
+
import { displayPhoneNumber, truncateAddress } from "@getpara/web-sdk";
|
|
8
|
+
import { getExternalWalletDisplayName, getExternalWalletIcon, safeStyled } from "../utils/index.js";
|
|
9
|
+
function getAuthDisplay(authInfo, { withAddress = false } = {}) {
|
|
10
|
+
var _a;
|
|
11
|
+
const { authType, displayName, identifier, pfpUrl, externalWallet } = authInfo;
|
|
10
12
|
switch (authType) {
|
|
11
13
|
case "email":
|
|
12
|
-
return {
|
|
14
|
+
return { name: identifier.toLowerCase(), icon: "mail" };
|
|
13
15
|
case "phone":
|
|
14
|
-
return {
|
|
16
|
+
return { name: displayPhoneNumber(identifier), icon: "phone" };
|
|
15
17
|
case "farcaster":
|
|
16
|
-
return {
|
|
18
|
+
return __spreadValues({ name: displayName != null ? displayName : `@${identifier}` }, pfpUrl ? { src: pfpUrl } : { icon: "farcasterBrand" });
|
|
17
19
|
case "telegram":
|
|
18
|
-
return {
|
|
20
|
+
return __spreadValues({
|
|
21
|
+
name: displayName != null ? displayName : `Telegram User @${identifier}`
|
|
22
|
+
}, pfpUrl ? { src: pfpUrl } : { icon: "telegramBrand" });
|
|
19
23
|
case "externalWallet":
|
|
20
|
-
return {
|
|
24
|
+
return {
|
|
25
|
+
name: externalWallet ? getExternalWalletDisplayName(externalWallet, { withAddress }) : truncateAddress(identifier, "EVM"),
|
|
26
|
+
icon: (_a = getExternalWalletIcon(externalWallet == null ? void 0 : externalWallet.providerId)) != null ? _a : "wallet02"
|
|
27
|
+
};
|
|
21
28
|
default:
|
|
22
|
-
return {
|
|
29
|
+
return { name: null, icon: null };
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
const UserIdentifier = ({ authInfo }) => {
|
|
26
33
|
if (!authInfo) {
|
|
27
34
|
return null;
|
|
28
35
|
}
|
|
29
|
-
const { authType
|
|
30
|
-
const {
|
|
36
|
+
const { authType } = authInfo;
|
|
37
|
+
const { name, icon, src } = getAuthDisplay(authInfo, { withAddress: true });
|
|
31
38
|
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
32
|
-
/* @__PURE__ */ jsx(IconContainer, { children:
|
|
33
|
-
/* @__PURE__ */ jsx(IdentifierText, { variant: "bodyS", weight: "medium", children:
|
|
39
|
+
/* @__PURE__ */ jsx(IconContainer, { children: src ? /* @__PURE__ */ jsx(Avatar, { src, size: "20px", variant: "round" }) : /* @__PURE__ */ jsx(Icon, { icon, size: authType === "telegram" ? "20px" : "13px" }) }),
|
|
40
|
+
/* @__PURE__ */ jsx(IdentifierText, { variant: "bodyS", weight: "medium", children: name })
|
|
34
41
|
] });
|
|
35
42
|
};
|
|
36
|
-
const Container =
|
|
43
|
+
const Container = safeStyled.div`
|
|
37
44
|
padding: 8px 12px 8px 8px;
|
|
38
45
|
border-radius: 1000px;
|
|
39
46
|
background-color: var(--cpsl-color-background-4);
|
|
@@ -42,10 +49,10 @@ const Container = styled.div`
|
|
|
42
49
|
justify-content: flex-start;
|
|
43
50
|
gap: 4px;
|
|
44
51
|
`;
|
|
45
|
-
const IdentifierText =
|
|
52
|
+
const IdentifierText = safeStyled(CpslText)`
|
|
46
53
|
--color-override: var(--cpsl-color-background-96);
|
|
47
54
|
`;
|
|
48
|
-
const IconContainer =
|
|
55
|
+
const IconContainer = safeStyled.div`
|
|
49
56
|
display: flex;
|
|
50
57
|
background: var(--cpsl-color-background-0);
|
|
51
58
|
align-items: center;
|
|
@@ -54,13 +61,14 @@ const IconContainer = styled.div`
|
|
|
54
61
|
width: 20px;
|
|
55
62
|
height: 20px;
|
|
56
63
|
`;
|
|
57
|
-
const Icon =
|
|
64
|
+
const Icon = safeStyled(CpslIcon)`
|
|
58
65
|
--icon-color: var(--cpsl-color-text-primary);
|
|
59
66
|
`;
|
|
60
|
-
const Avatar =
|
|
67
|
+
const Avatar = safeStyled(CpslAvatar)`
|
|
61
68
|
--container-border-width: 0;
|
|
62
69
|
--container-padding: 0;
|
|
63
70
|
`;
|
|
64
71
|
export {
|
|
65
|
-
UserIdentifier
|
|
72
|
+
UserIdentifier,
|
|
73
|
+
getAuthDisplay
|
|
66
74
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CpslInput, CpslText } from '@getpara/react-components';
|
|
2
|
-
export declare const SpinnerContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
-
export declare const CenteredColumnContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
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;
|
|
3
|
+
export declare const CenteredColumnContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
4
|
export declare const FilledDisabledInput: typeof CpslInput;
|
|
5
5
|
export declare const FullWidthFilledDisabledInput: typeof CpslInput;
|
|
6
6
|
export declare const CenteredText: typeof CpslText;
|
|
7
|
-
export declare const HeaderButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
7
|
+
export declare const HeaderButton: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
8
8
|
ref?: import("react").Ref<any>;
|
|
9
9
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-GOCCUU3Z.js";
|
|
3
3
|
import { CpslButton, CpslInput, CpslText } from "@getpara/react-components";
|
|
4
|
-
import
|
|
5
|
-
const SpinnerContainer =
|
|
4
|
+
import { safeStyled } from "../utils/index.js";
|
|
5
|
+
const SpinnerContainer = safeStyled.div`
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
`;
|
|
10
|
-
const CenteredColumnContainer =
|
|
10
|
+
const CenteredColumnContainer = safeStyled.div`
|
|
11
11
|
width: 100%;
|
|
12
12
|
height: 100%;
|
|
13
13
|
align-self: center;
|
|
@@ -16,21 +16,21 @@ const CenteredColumnContainer = styled.div`
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
gap: 8px;
|
|
18
18
|
`;
|
|
19
|
-
const FilledDisabledInput =
|
|
19
|
+
const FilledDisabledInput = safeStyled(CpslInput)`
|
|
20
20
|
--container-border-color: var(--cpsl-color-input-border-placeholder);
|
|
21
21
|
--container-background-color: var(--cpsl-color-background-0);
|
|
22
22
|
--input-background-color: transparent;
|
|
23
23
|
--input-font-weight: 500;
|
|
24
24
|
--input-color: var(--cpsl-color-text-secondary) !important;
|
|
25
25
|
`;
|
|
26
|
-
const FullWidthFilledDisabledInput =
|
|
26
|
+
const FullWidthFilledDisabledInput = safeStyled(FilledDisabledInput)`
|
|
27
27
|
width: 100%;
|
|
28
28
|
`;
|
|
29
|
-
const CenteredText =
|
|
29
|
+
const CenteredText = safeStyled(CpslText)`
|
|
30
30
|
width: 100%;
|
|
31
31
|
text-align: center;
|
|
32
32
|
`;
|
|
33
|
-
const HeaderButton =
|
|
33
|
+
const HeaderButton = safeStyled(CpslButton)`
|
|
34
34
|
flex: 0;
|
|
35
35
|
--button-padding-top: 2px;
|
|
36
36
|
--button-padding-bottom: 2px;
|
package/dist/components/index.js
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ExternalWalletInfo } from '@getpara/web-sdk';
|
|
2
|
+
export declare const defaultCosmosExternalWallet: {
|
|
3
|
+
wallets: any[];
|
|
4
|
+
chains: any[];
|
|
5
|
+
chainId: any;
|
|
6
|
+
disconnect: () => Promise<void>;
|
|
7
|
+
switchChain: () => Promise<void>;
|
|
8
|
+
connectParaEmbedded: () => Promise<{}>;
|
|
9
|
+
signMessage: () => Promise<{}>;
|
|
10
|
+
signVerificationMessage: () => Promise<{}>;
|
|
11
|
+
requestInfo: () => Promise<any>;
|
|
12
|
+
disconnectBase: () => Promise<void>;
|
|
13
|
+
useAccount: () => any;
|
|
14
|
+
};
|
|
15
|
+
export declare const defaultEvmExternalWallet: {
|
|
16
|
+
wallets: any[];
|
|
17
|
+
chains: any[];
|
|
18
|
+
chainId: any;
|
|
19
|
+
username: any;
|
|
20
|
+
avatar: any;
|
|
21
|
+
balance: any;
|
|
22
|
+
disconnect: () => Promise<void>;
|
|
23
|
+
switchChain: () => Promise<void>;
|
|
24
|
+
connectParaEmbedded: () => Promise<{}>;
|
|
25
|
+
signMessage: () => Promise<{}>;
|
|
26
|
+
signVerificationMessage: () => Promise<{}>;
|
|
27
|
+
getWalletBalance: () => Promise<any>;
|
|
28
|
+
requestInfo: () => Promise<ExternalWalletInfo>;
|
|
29
|
+
disconnectBase: () => Promise<void>;
|
|
30
|
+
useAccount: () => any;
|
|
31
|
+
farcasterStatus: {
|
|
32
|
+
isPresent: false;
|
|
33
|
+
};
|
|
34
|
+
verificationStage: any;
|
|
35
|
+
};
|
|
36
|
+
export declare const defaultSolanaExternalWallet: {
|
|
37
|
+
wallets: any[];
|
|
38
|
+
disconnect: () => Promise<void>;
|
|
39
|
+
signMessage: () => Promise<{}>;
|
|
40
|
+
signVerificationMessage: () => Promise<{}>;
|
|
41
|
+
requestInfo: () => Promise<ExternalWalletInfo>;
|
|
42
|
+
disconnectBase: () => Promise<void>;
|
|
43
|
+
useWallet: () => any;
|
|
44
|
+
farcasterStatus: {
|
|
45
|
+
isPresent: false;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-GOCCUU3Z.js";
|
|
3
|
+
const defaultCosmosExternalWallet = {
|
|
4
|
+
wallets: [],
|
|
5
|
+
chains: [],
|
|
6
|
+
chainId: void 0,
|
|
7
|
+
disconnect: () => Promise.resolve(),
|
|
8
|
+
switchChain: () => Promise.resolve(),
|
|
9
|
+
connectParaEmbedded: () => Promise.resolve({}),
|
|
10
|
+
signMessage: () => Promise.resolve({}),
|
|
11
|
+
signVerificationMessage: () => Promise.resolve({}),
|
|
12
|
+
requestInfo: () => Promise.resolve({}),
|
|
13
|
+
disconnectBase: () => Promise.resolve(),
|
|
14
|
+
useAccount: () => void 0
|
|
15
|
+
};
|
|
16
|
+
const defaultEvmExternalWallet = {
|
|
17
|
+
wallets: [],
|
|
18
|
+
chains: [],
|
|
19
|
+
chainId: void 0,
|
|
20
|
+
username: void 0,
|
|
21
|
+
avatar: void 0,
|
|
22
|
+
balance: void 0,
|
|
23
|
+
disconnect: () => Promise.resolve(),
|
|
24
|
+
switchChain: () => Promise.resolve(),
|
|
25
|
+
connectParaEmbedded: () => Promise.resolve({}),
|
|
26
|
+
signMessage: () => Promise.resolve({}),
|
|
27
|
+
signVerificationMessage: () => Promise.resolve({}),
|
|
28
|
+
getWalletBalance: () => Promise.resolve(void 0),
|
|
29
|
+
requestInfo: () => Promise.resolve({}),
|
|
30
|
+
disconnectBase: () => Promise.resolve(),
|
|
31
|
+
useAccount: () => void 0,
|
|
32
|
+
farcasterStatus: { isPresent: false },
|
|
33
|
+
verificationStage: void 0
|
|
34
|
+
};
|
|
35
|
+
const defaultSolanaExternalWallet = {
|
|
36
|
+
wallets: [],
|
|
37
|
+
disconnect: () => Promise.resolve(),
|
|
38
|
+
signMessage: () => Promise.resolve({}),
|
|
39
|
+
signVerificationMessage: () => Promise.resolve({}),
|
|
40
|
+
requestInfo: () => Promise.resolve({}),
|
|
41
|
+
disconnectBase: () => Promise.resolve(),
|
|
42
|
+
useWallet: () => void 0,
|
|
43
|
+
farcasterStatus: { isPresent: false }
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
defaultCosmosExternalWallet,
|
|
47
|
+
defaultEvmExternalWallet,
|
|
48
|
+
defaultSolanaExternalWallet
|
|
49
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IconType } from '@getpara/react-components';
|
|
2
|
+
import { TLinkedAccountType } from '@getpara/web-sdk';
|
|
3
|
+
import { DisplayMetadata } from '../types/commonTypes.js';
|
|
4
|
+
export declare const ACCOUNT_TYPES: {
|
|
5
|
+
[key in TLinkedAccountType | string]: DisplayMetadata & {
|
|
6
|
+
isExternalWallet?: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function getAccountTypeName(type: TLinkedAccountType | string | undefined, { inline }?: {
|
|
10
|
+
inline?: boolean;
|
|
11
|
+
}): string | undefined;
|
|
12
|
+
export declare function getAccountTypeLogo(type: TLinkedAccountType | undefined): IconType | undefined;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-GOCCUU3Z.js";
|
|
3
|
+
const ACCOUNT_TYPES = {
|
|
4
|
+
"EMAIL": {
|
|
5
|
+
icon: "mail",
|
|
6
|
+
name: "Email",
|
|
7
|
+
inlineText: "email address",
|
|
8
|
+
isPlain: true
|
|
9
|
+
},
|
|
10
|
+
"PHONE": {
|
|
11
|
+
icon: "phone",
|
|
12
|
+
name: "Phone",
|
|
13
|
+
inlineText: "phone number",
|
|
14
|
+
isPlain: true
|
|
15
|
+
},
|
|
16
|
+
"EXTERNAL_WALLET": {
|
|
17
|
+
icon: "wallet",
|
|
18
|
+
name: "External Wallet",
|
|
19
|
+
inlineText: "external wallet",
|
|
20
|
+
isPlain: true
|
|
21
|
+
},
|
|
22
|
+
"GOOGLE": {
|
|
23
|
+
icon: "google",
|
|
24
|
+
iconBranded: "googleBrand",
|
|
25
|
+
name: "Google"
|
|
26
|
+
},
|
|
27
|
+
"TWITTER": {
|
|
28
|
+
icon: "twitter",
|
|
29
|
+
// Not using branded here to ensure the icon looks correct in dark mode
|
|
30
|
+
iconBranded: "twitter",
|
|
31
|
+
name: "X / Twitter",
|
|
32
|
+
inlineText: "X account",
|
|
33
|
+
isDark: true
|
|
34
|
+
},
|
|
35
|
+
"APPLE": {
|
|
36
|
+
icon: "apple",
|
|
37
|
+
// Not using branded here to ensure the icon looks correct in dark mode
|
|
38
|
+
iconBranded: "apple",
|
|
39
|
+
name: "Apple",
|
|
40
|
+
isDark: true
|
|
41
|
+
},
|
|
42
|
+
"DISCORD": {
|
|
43
|
+
icon: "discord",
|
|
44
|
+
iconBranded: "discordBrand",
|
|
45
|
+
name: "Discord"
|
|
46
|
+
},
|
|
47
|
+
"FACEBOOK": {
|
|
48
|
+
icon: "facebook",
|
|
49
|
+
iconBranded: "facebookBrand",
|
|
50
|
+
name: "Facebook"
|
|
51
|
+
},
|
|
52
|
+
"FARCASTER": {
|
|
53
|
+
icon: "farcaster",
|
|
54
|
+
iconBranded: "farcasterBrand",
|
|
55
|
+
name: "Farcaster"
|
|
56
|
+
},
|
|
57
|
+
"TELEGRAM": {
|
|
58
|
+
icon: "telegram",
|
|
59
|
+
iconBranded: "telegramBrand",
|
|
60
|
+
name: "Telegram"
|
|
61
|
+
},
|
|
62
|
+
"MetaMask": {
|
|
63
|
+
icon: "metamask",
|
|
64
|
+
name: "MetaMask",
|
|
65
|
+
isExternalWallet: true
|
|
66
|
+
},
|
|
67
|
+
"Rainbow": {
|
|
68
|
+
icon: "rainbow",
|
|
69
|
+
name: "Rainbow",
|
|
70
|
+
isExternalWallet: true
|
|
71
|
+
},
|
|
72
|
+
"Coinbase Wallet": {
|
|
73
|
+
icon: "coinbase",
|
|
74
|
+
name: "Coinbase Wallet",
|
|
75
|
+
isExternalWallet: true
|
|
76
|
+
},
|
|
77
|
+
"WalletConnect": {
|
|
78
|
+
icon: "walletConnect",
|
|
79
|
+
name: "WalletConnect",
|
|
80
|
+
isExternalWallet: true
|
|
81
|
+
},
|
|
82
|
+
"Zerion": {
|
|
83
|
+
icon: "zerion",
|
|
84
|
+
name: "Zerion",
|
|
85
|
+
isExternalWallet: true
|
|
86
|
+
},
|
|
87
|
+
"Safe": {
|
|
88
|
+
icon: "safe",
|
|
89
|
+
name: "Safe",
|
|
90
|
+
isExternalWallet: true
|
|
91
|
+
},
|
|
92
|
+
"Rabby": {
|
|
93
|
+
icon: "rabby",
|
|
94
|
+
name: "Rabby",
|
|
95
|
+
isExternalWallet: true
|
|
96
|
+
},
|
|
97
|
+
"OKX Wallet": {
|
|
98
|
+
icon: "okx",
|
|
99
|
+
name: "OKX Wallet",
|
|
100
|
+
isExternalWallet: true
|
|
101
|
+
},
|
|
102
|
+
"Phantom": {
|
|
103
|
+
icon: "phantom",
|
|
104
|
+
name: "Phantom",
|
|
105
|
+
isExternalWallet: true
|
|
106
|
+
},
|
|
107
|
+
"Glow": {
|
|
108
|
+
icon: "glow",
|
|
109
|
+
name: "Glow",
|
|
110
|
+
isExternalWallet: true
|
|
111
|
+
},
|
|
112
|
+
"Backpack": {
|
|
113
|
+
icon: "backpack",
|
|
114
|
+
name: "Backpack",
|
|
115
|
+
isExternalWallet: true
|
|
116
|
+
},
|
|
117
|
+
"Keplr": {
|
|
118
|
+
icon: "keplr",
|
|
119
|
+
name: "Keplr",
|
|
120
|
+
isExternalWallet: true
|
|
121
|
+
},
|
|
122
|
+
"Leap": {
|
|
123
|
+
icon: "leap",
|
|
124
|
+
name: "Leap",
|
|
125
|
+
isExternalWallet: true
|
|
126
|
+
},
|
|
127
|
+
"HaHa": {
|
|
128
|
+
icon: "haha",
|
|
129
|
+
name: "HaHa",
|
|
130
|
+
isExternalWallet: true
|
|
131
|
+
},
|
|
132
|
+
"Cosmostation": {
|
|
133
|
+
icon: "cosmostation",
|
|
134
|
+
name: "Cosmostation",
|
|
135
|
+
isExternalWallet: true
|
|
136
|
+
},
|
|
137
|
+
"Solflare": {
|
|
138
|
+
icon: "solflare",
|
|
139
|
+
name: "Solflare",
|
|
140
|
+
isExternalWallet: true
|
|
141
|
+
},
|
|
142
|
+
"Valora": {
|
|
143
|
+
icon: "valora",
|
|
144
|
+
name: "Valora",
|
|
145
|
+
isExternalWallet: true
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function getAccountTypeName(type, { inline = false } = {}) {
|
|
149
|
+
var _a;
|
|
150
|
+
const data = type ? ACCOUNT_TYPES[type] : void 0;
|
|
151
|
+
return data ? inline ? (_a = data.inlineText) != null ? _a : `${data.name} ${data.isExternalWallet ? "wallet" : "account"}` : data.name : void 0;
|
|
152
|
+
}
|
|
153
|
+
function getAccountTypeLogo(type) {
|
|
154
|
+
return type ? ACCOUNT_TYPES[type].iconBranded || ACCOUNT_TYPES[type].icon : void 0;
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
ACCOUNT_TYPES,
|
|
158
|
+
getAccountTypeLogo,
|
|
159
|
+
getAccountTypeName
|
|
160
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-GOCCUU3Z.js";
|
|
3
|
+
import { UAParser } from "ua-parser-js";
|
|
4
|
+
function useUserAgent() {
|
|
5
|
+
const userAgent = typeof window !== "undefined" ? window.navigator.userAgent : void 0;
|
|
6
|
+
return UAParser(userAgent);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
useUserAgent
|
|
10
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconType } from '@getpara/react-components';
|
|
2
|
+
export type Tab<T> = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: T;
|
|
5
|
+
icon: IconType;
|
|
6
|
+
};
|
|
7
|
+
export type DisplayMetadata = {
|
|
8
|
+
name: string;
|
|
9
|
+
inlineText?: string;
|
|
10
|
+
icon: IconType;
|
|
11
|
+
iconBranded?: IconType;
|
|
12
|
+
isDark?: boolean;
|
|
13
|
+
isCircular?: boolean;
|
|
14
|
+
isPlain?: boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AuthStateLogin, AuthStateVerify, TWalletType } from '@getpara/web-sdk';
|
|
1
|
+
import ParaWeb, { AuthStateLogin, AuthStateVerify, ExternalWalletInfo, TExternalWallet, TWalletType, Wallet } from '@getpara/web-sdk';
|
|
2
2
|
export type WalletMetadata = {
|
|
3
3
|
id: string;
|
|
4
|
+
internalId: TExternalWallet;
|
|
4
5
|
name: string;
|
|
5
6
|
iconUrl: string;
|
|
6
7
|
rdns?: string;
|
|
@@ -26,17 +27,18 @@ export type WalletMetadata = {
|
|
|
26
27
|
linux?: string;
|
|
27
28
|
desktop?: string;
|
|
28
29
|
};
|
|
30
|
+
hasIosSafariExtension?: boolean;
|
|
29
31
|
};
|
|
30
32
|
export type CommonWallet = {
|
|
31
|
-
connect: () => Promise<{
|
|
33
|
+
connect: (isConnectionOnly?: boolean) => Promise<{
|
|
32
34
|
address?: string;
|
|
33
|
-
|
|
35
|
+
ethAddress?: string;
|
|
34
36
|
error?: string;
|
|
35
37
|
authState?: AuthStateLogin | AuthStateVerify;
|
|
36
38
|
}>;
|
|
37
|
-
connectMobile: (isManualWalletConnect?: boolean) => Promise<{
|
|
39
|
+
connectMobile: (isManualWalletConnect?: boolean, isConnectionOnly?: boolean) => Promise<{
|
|
38
40
|
address?: string;
|
|
39
|
-
|
|
41
|
+
ethAddress?: string;
|
|
40
42
|
error?: string;
|
|
41
43
|
authState?: AuthStateLogin | AuthStateVerify;
|
|
42
44
|
}>;
|
|
@@ -46,36 +48,66 @@ export type CommonChain = {
|
|
|
46
48
|
id: string | number;
|
|
47
49
|
name: string;
|
|
48
50
|
};
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
COINBASE = "COINBASE",
|
|
53
|
-
WALLETCONNECT = "WALLETCONNECT",
|
|
54
|
-
ZERION = "ZERION",
|
|
55
|
-
SAFE = "SAFE",
|
|
56
|
-
RABBY = "RABBY"
|
|
57
|
-
}
|
|
58
|
-
export declare enum SolanaWallet {
|
|
59
|
-
PHANTOM = "PHANTOM",
|
|
60
|
-
GLOW = "GLOW",
|
|
61
|
-
BACKPACK = "BACKPACK"
|
|
62
|
-
}
|
|
63
|
-
export declare enum CosmosWallet {
|
|
64
|
-
KEPLR = "KEPLR",
|
|
65
|
-
LEAP = "LEAP"
|
|
66
|
-
}
|
|
67
|
-
export declare const ExternalWallet: {
|
|
68
|
-
KEPLR: CosmosWallet.KEPLR;
|
|
69
|
-
LEAP: CosmosWallet.LEAP;
|
|
70
|
-
PHANTOM: SolanaWallet.PHANTOM;
|
|
71
|
-
GLOW: SolanaWallet.GLOW;
|
|
72
|
-
BACKPACK: SolanaWallet.BACKPACK;
|
|
73
|
-
METAMASK: EvmWallet.METAMASK;
|
|
74
|
-
RAINBOW: EvmWallet.RAINBOW;
|
|
75
|
-
COINBASE: EvmWallet.COINBASE;
|
|
76
|
-
WALLETCONNECT: EvmWallet.WALLETCONNECT;
|
|
77
|
-
ZERION: EvmWallet.ZERION;
|
|
78
|
-
SAFE: EvmWallet.SAFE;
|
|
79
|
-
RABBY: EvmWallet.RABBY;
|
|
51
|
+
export type SignArgs = {
|
|
52
|
+
message: string;
|
|
53
|
+
externalWallet?: ExternalWalletInfo;
|
|
80
54
|
};
|
|
81
|
-
export type
|
|
55
|
+
export type SignResult = {
|
|
56
|
+
address?: string;
|
|
57
|
+
signature?: string;
|
|
58
|
+
error?: string;
|
|
59
|
+
};
|
|
60
|
+
export type SwitchChainResult = {
|
|
61
|
+
error: string[];
|
|
62
|
+
} | void;
|
|
63
|
+
export type ConnectParaEmbedded = {
|
|
64
|
+
connectParaEmbedded: () => Promise<{
|
|
65
|
+
result?: unknown;
|
|
66
|
+
error?: string;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export type ChainManagement<ChainId, R extends SwitchChainResult = SwitchChainResult> = {
|
|
70
|
+
chains: CommonChain[];
|
|
71
|
+
chainId?: ChainId;
|
|
72
|
+
switchChain: (_: ChainId) => Promise<R>;
|
|
73
|
+
};
|
|
74
|
+
export type BalanceManagement<B = string> = {
|
|
75
|
+
balance?: B;
|
|
76
|
+
getWalletBalance: () => Promise<B | undefined>;
|
|
77
|
+
};
|
|
78
|
+
export type FarcasterMiniAppManagement = {
|
|
79
|
+
farcasterStatus: {
|
|
80
|
+
isPresent: false;
|
|
81
|
+
} | {
|
|
82
|
+
isPresent: true;
|
|
83
|
+
isConnected: false;
|
|
84
|
+
address?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
isPresent: true;
|
|
87
|
+
isConnected: true;
|
|
88
|
+
address: string;
|
|
89
|
+
} | undefined;
|
|
90
|
+
};
|
|
91
|
+
export type ExternalWalletContextType<S extends SignResult = SignResult> = {
|
|
92
|
+
wallets: CommonWallet[];
|
|
93
|
+
disconnect: () => Promise<void>;
|
|
94
|
+
signMessage: (_: SignArgs) => Promise<S>;
|
|
95
|
+
signVerificationMessage: () => Promise<S>;
|
|
96
|
+
requestInfo: (_: string) => Promise<ExternalWalletInfo>;
|
|
97
|
+
disconnectBase: (_?: string) => Promise<void>;
|
|
98
|
+
};
|
|
99
|
+
export type ExternalWalletProviderConfigBase = {
|
|
100
|
+
onSwitchWallet?: (args: {
|
|
101
|
+
address?: string;
|
|
102
|
+
error?: string;
|
|
103
|
+
}) => void;
|
|
104
|
+
para: ParaWeb;
|
|
105
|
+
walletsWithFullAuth: TExternalWallet[];
|
|
106
|
+
includeWalletVerification?: boolean;
|
|
107
|
+
connectionOnly?: boolean;
|
|
108
|
+
connectedWallet?: Omit<Wallet, 'signer'> | null;
|
|
109
|
+
};
|
|
110
|
+
export type ExternalWalletProviderConfig<W, P = {}> = ExternalWalletProviderConfigBase & {
|
|
111
|
+
wallets: W[];
|
|
112
|
+
} & P;
|
|
113
|
+
export { type TExternalWallet };
|
|
@@ -1,32 +1 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../chunk-GOCCUU3Z.js";
|
|
5
|
-
var EvmWallet = /* @__PURE__ */ ((EvmWallet2) => {
|
|
6
|
-
EvmWallet2["METAMASK"] = "METAMASK";
|
|
7
|
-
EvmWallet2["RAINBOW"] = "RAINBOW";
|
|
8
|
-
EvmWallet2["COINBASE"] = "COINBASE";
|
|
9
|
-
EvmWallet2["WALLETCONNECT"] = "WALLETCONNECT";
|
|
10
|
-
EvmWallet2["ZERION"] = "ZERION";
|
|
11
|
-
EvmWallet2["SAFE"] = "SAFE";
|
|
12
|
-
EvmWallet2["RABBY"] = "RABBY";
|
|
13
|
-
return EvmWallet2;
|
|
14
|
-
})(EvmWallet || {});
|
|
15
|
-
var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
|
|
16
|
-
SolanaWallet2["PHANTOM"] = "PHANTOM";
|
|
17
|
-
SolanaWallet2["GLOW"] = "GLOW";
|
|
18
|
-
SolanaWallet2["BACKPACK"] = "BACKPACK";
|
|
19
|
-
return SolanaWallet2;
|
|
20
|
-
})(SolanaWallet || {});
|
|
21
|
-
var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
|
|
22
|
-
CosmosWallet2["KEPLR"] = "KEPLR";
|
|
23
|
-
CosmosWallet2["LEAP"] = "LEAP";
|
|
24
|
-
return CosmosWallet2;
|
|
25
|
-
})(CosmosWallet || {});
|
|
26
|
-
const ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet), SolanaWallet), CosmosWallet);
|
|
27
|
-
export {
|
|
28
|
-
CosmosWallet,
|
|
29
|
-
EvmWallet,
|
|
30
|
-
ExternalWallet,
|
|
31
|
-
SolanaWallet
|
|
32
|
-
};
|