@getpara/react-common 2.0.0-fc.3 → 2.1.0
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/README.md +13 -0
- package/dist/{chunk-GOCCUU3Z.js → chunk-MMUBH76A.js} +17 -0
- package/dist/classes/ParaInternal.d.ts +18 -5
- package/dist/classes/ParaInternal.js +15 -1
- package/dist/components/HeroSpinner.d.ts +2 -1
- package/dist/components/HeroSpinner.js +9 -3
- package/dist/components/KnownDevices.js +1 -1
- package/dist/components/MoonPayEmbed.d.ts +3 -1
- package/dist/components/MoonPayEmbed.js +56 -82
- package/dist/components/NetworkSpeedBanner.js +2 -4
- package/dist/components/QRCode.js +1 -1
- package/dist/components/RampEmbed.d.ts +1 -1
- package/dist/components/RampEmbed.js +17 -29
- package/dist/components/UserIdentifier.d.ts +8 -0
- package/dist/components/UserIdentifier.js +25 -16
- package/dist/components/WalletSelect.d.ts +33 -0
- package/dist/components/WalletSelect.js +171 -0
- package/dist/components/WalletTypeIcon.d.ts +9 -0
- package/dist/components/WalletTypeIcon.js +45 -0
- package/dist/components/WarningBanner.d.ts +7 -0
- package/dist/components/WarningBanner.js +60 -0
- package/dist/components/common.js +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/constants/aaguiMetadata.js +1 -1
- package/dist/constants/externalWalletDefaults.d.ts +10 -1
- package/dist/constants/externalWalletDefaults.js +8 -3
- package/dist/constants/index.d.ts +37 -0
- package/dist/constants/index.js +152 -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/useCopyToClipboard.js +1 -1
- package/dist/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/hooks/useDropdownPosition.js +33 -0
- package/dist/hooks/useUserAgent.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types/commonTypes.d.ts +15 -0
- package/dist/types/commonTypes.js +1 -0
- package/dist/types/externalWalletCommon.d.ts +14 -4
- package/dist/types/index.d.ts +7 -4
- package/dist/types/index.js +1 -0
- package/dist/utils/formatBiometricHints.js +1 -1
- package/dist/utils/getBrowserName.js +1 -1
- package/dist/utils/getDeviceLogo.js +1 -1
- package/dist/utils/getDeviceModelName.js +1 -1
- package/dist/utils/getExternalWalletDisplayName.d.ts +3 -1
- package/dist/utils/getExternalWalletDisplayName.js +7 -15
- package/dist/utils/getExternalWalletIcon.d.ts +5 -0
- package/dist/utils/getExternalWalletIcon.js +17 -0
- package/dist/utils/index.d.ts +17 -16
- package/dist/utils/index.js +26 -31
- package/dist/utils/openMobileUrl.d.ts +1 -0
- package/dist/utils/openMobileUrl.js +34 -0
- package/dist/utils/safeStyled.js +1 -1
- package/package.json +4 -4
- package/dist/utils/offRampSend.d.ts +0 -7
- package/dist/utils/offRampSend.js +0 -75
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-MMUBH76A.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useEffect, useRef } from "react";
|
|
8
|
+
import { useDropdownPosition, useCopyToClipboard } from "../hooks/index.js";
|
|
9
|
+
import { safeStyled } from "../utils/index.js";
|
|
10
|
+
import { CpslButton, CpslIcon, CpslSelect, CpslSelectItem, CpslText } from "@getpara/react-components";
|
|
11
|
+
import { WalletTypeIcon as WalletTypeIconBase } from "./WalletTypeIcon.js";
|
|
12
|
+
const Entry = ({
|
|
13
|
+
isDark = false,
|
|
14
|
+
withCopy,
|
|
15
|
+
slot,
|
|
16
|
+
withIcon,
|
|
17
|
+
name,
|
|
18
|
+
type,
|
|
19
|
+
externalWallet,
|
|
20
|
+
copyValue,
|
|
21
|
+
isMultiOption
|
|
22
|
+
}) => {
|
|
23
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
24
|
+
return /* @__PURE__ */ jsxs(WalletContainer, { slot, style: { flex: "1" }, isMultiOption, children: [
|
|
25
|
+
withIcon && /* @__PURE__ */ jsx(WalletTypeIcon, { isDark, externalWallet, walletType: type, size: "32px", inset: "6px" }),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
CpslText,
|
|
28
|
+
{
|
|
29
|
+
variant: "bodyM",
|
|
30
|
+
color: "contrast",
|
|
31
|
+
style: { flex: "1", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "clip" },
|
|
32
|
+
children: name
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
withCopy && copyValue && /* @__PURE__ */ jsx(
|
|
36
|
+
CopyButton,
|
|
37
|
+
{
|
|
38
|
+
id: "ignore-click",
|
|
39
|
+
size: "small",
|
|
40
|
+
variant: "ghost",
|
|
41
|
+
onClick: (e) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
copy(copyValue);
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ jsx(CpslIcon, { id: "ignore-click", slot: "start", icon: isCopied ? "check" : "copy" })
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
const WalletSelect = ({
|
|
52
|
+
isDark = false,
|
|
53
|
+
style,
|
|
54
|
+
className,
|
|
55
|
+
value,
|
|
56
|
+
onChange,
|
|
57
|
+
options,
|
|
58
|
+
getEntryProps,
|
|
59
|
+
getSelectValue,
|
|
60
|
+
helperText
|
|
61
|
+
}) => {
|
|
62
|
+
const containerRef = useRef(null);
|
|
63
|
+
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
64
|
+
const isMulti = options.length > 1;
|
|
65
|
+
const ActiveEntry = value ? /* @__PURE__ */ jsx(Entry, __spreadProps(__spreadValues({ isDark, withCopy: true, slot: "selected-item" }, getEntryProps(value)), { isMultiOption: isMulti })) : null;
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (dropdownMaxHeight && (value == null ? void 0 : value.address)) {
|
|
68
|
+
resize();
|
|
69
|
+
}
|
|
70
|
+
}, [value, options, dropdownMaxHeight]);
|
|
71
|
+
return /* @__PURE__ */ jsxs(Container, { className, style, children: [
|
|
72
|
+
isMulti && helperText && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "semiBold", children: helperText }),
|
|
73
|
+
/* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: /* @__PURE__ */ jsxs(
|
|
74
|
+
Select,
|
|
75
|
+
{
|
|
76
|
+
selectedValue: getSelectValue(value),
|
|
77
|
+
onCpslSelectValueChange: (e) => {
|
|
78
|
+
const [id, type] = e.detail.split("~");
|
|
79
|
+
onChange(options.find((o) => o.id === id && o.type === type));
|
|
80
|
+
},
|
|
81
|
+
showFormattedSelectedItem: true,
|
|
82
|
+
placeholder: "Choose wallet...",
|
|
83
|
+
anchorElId: "addressInputContainer",
|
|
84
|
+
dropdownMaxHeight,
|
|
85
|
+
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
86
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
|
|
87
|
+
selectedItemVariant: "bodyXS",
|
|
88
|
+
icon: isMulti ? "chevronUp" : null,
|
|
89
|
+
disabled: !isMulti,
|
|
90
|
+
isMultiOption: isMulti,
|
|
91
|
+
children: [
|
|
92
|
+
value && ActiveEntry,
|
|
93
|
+
(options || []).map((wallet) => {
|
|
94
|
+
const key = getSelectValue(wallet);
|
|
95
|
+
return /* @__PURE__ */ jsx(SelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsx(Entry, __spreadValues({ isDark }, getEntryProps(wallet))) }, key);
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
) })
|
|
100
|
+
] });
|
|
101
|
+
};
|
|
102
|
+
const Container = safeStyled.div`
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
gap: 8px;
|
|
106
|
+
align-items: center;
|
|
107
|
+
`;
|
|
108
|
+
const WalletContainer = safeStyled.div`
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 8px;
|
|
112
|
+
max-width: 100%;
|
|
113
|
+
padding-inline-end: ${({ isMultiOption }) => isMultiOption ? "40px" : "0px"};
|
|
114
|
+
`;
|
|
115
|
+
const Select = safeStyled(CpslSelect)`
|
|
116
|
+
--icon-width: 32px;
|
|
117
|
+
--icon-height: 32px;
|
|
118
|
+
--container-border-color: var(--cpsl-color-background-16);
|
|
119
|
+
--container-background-color-disabled: var(--container-background-color);
|
|
120
|
+
width: 100%;
|
|
121
|
+
position: relative;
|
|
122
|
+
|
|
123
|
+
&::part(selected-text) {
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&::part(dropdown) {
|
|
128
|
+
min-width: ${({ $width }) => `${$width - 2}px`};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&::part(icon) {
|
|
132
|
+
--icon-color: var(--cpsl-color-text-primary);
|
|
133
|
+
position: absolute;
|
|
134
|
+
right: 12px;
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
const SelectItem = safeStyled(CpslSelectItem)`
|
|
138
|
+
--outer-container-padding-start: 0px;
|
|
139
|
+
--outer-container-padding-end: 0px;
|
|
140
|
+
--outer-container-padding-top: 0px;
|
|
141
|
+
--outer-container-padding-bottom: 0px;
|
|
142
|
+
--container-padding-start: 12px;
|
|
143
|
+
--container-padding-end: ${({ isMultiOption }) => isMultiOption ? "40px" : "12px"};
|
|
144
|
+
--container-padding-top: 8px;
|
|
145
|
+
--container-padding-bottom: 8px;
|
|
146
|
+
`;
|
|
147
|
+
const SelectContainer = safeStyled.div`
|
|
148
|
+
width: 100%;
|
|
149
|
+
position: relative;
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 8px;
|
|
153
|
+
border-radius: var(--cpsl-border-radius-tile-button);
|
|
154
|
+
background-color: var(--cpsl-color-background-4);
|
|
155
|
+
`;
|
|
156
|
+
const WalletTypeIcon = safeStyled(WalletTypeIconBase)`
|
|
157
|
+
--border: 1px solid var(--cpsl-color-background-8);
|
|
158
|
+
--border-radius: 4px;
|
|
159
|
+
`;
|
|
160
|
+
const CopyButton = safeStyled(CpslButton)`
|
|
161
|
+
cpsl-icon {
|
|
162
|
+
--height: 24px;
|
|
163
|
+
--width: 24px;
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
export {
|
|
167
|
+
Select,
|
|
168
|
+
SelectContainer,
|
|
169
|
+
SelectItem,
|
|
170
|
+
WalletSelect
|
|
171
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CpslIcon } from '@getpara/react-components';
|
|
2
|
+
import { TExternalWallet, TWalletType } from '@getpara/web-sdk';
|
|
3
|
+
import { CommonWallet } from '../types/index.js';
|
|
4
|
+
export declare function WalletTypeIcon({ className, walletType, externalWallet, isDark, ...props }: {
|
|
5
|
+
className?: string;
|
|
6
|
+
walletType: TWalletType;
|
|
7
|
+
isDark?: boolean;
|
|
8
|
+
externalWallet?: TExternalWallet | CommonWallet | string;
|
|
9
|
+
} & Parameters<typeof CpslIcon>[0]): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-MMUBH76A.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { CpslIcon } from "@getpara/react-components";
|
|
9
|
+
import { ACCOUNT_TYPES } from "../constants/oAuthLogos.js";
|
|
10
|
+
import { WALLET_TYPES_METADATA } from "../constants/index.js";
|
|
11
|
+
function WalletTypeIcon(_a) {
|
|
12
|
+
var _b = _a, {
|
|
13
|
+
className,
|
|
14
|
+
walletType,
|
|
15
|
+
externalWallet,
|
|
16
|
+
isDark = false
|
|
17
|
+
} = _b, props = __objRest(_b, [
|
|
18
|
+
"className",
|
|
19
|
+
"walletType",
|
|
20
|
+
"externalWallet",
|
|
21
|
+
"isDark"
|
|
22
|
+
]);
|
|
23
|
+
var _a2, _b2;
|
|
24
|
+
if (typeof externalWallet === "object" && "iconUrl" in externalWallet) {
|
|
25
|
+
return /* @__PURE__ */ jsx(CpslIcon, __spreadProps(__spreadValues({ className, src: externalWallet.iconUrl }, props), { inset: (_a2 = props.inset) != null ? _a2 : "10%" }));
|
|
26
|
+
}
|
|
27
|
+
const data = (externalWallet ? ACCOUNT_TYPES[externalWallet] : WALLET_TYPES_METADATA[walletType]) || {
|
|
28
|
+
icon: "wallet02",
|
|
29
|
+
isDark: true
|
|
30
|
+
};
|
|
31
|
+
props.size;
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
CpslIcon,
|
|
34
|
+
__spreadProps(__spreadValues({
|
|
35
|
+
className,
|
|
36
|
+
icon: data.icon,
|
|
37
|
+
invert: isDark && data.isDark
|
|
38
|
+
}, props), {
|
|
39
|
+
inset: (_b2 = props.inset) != null ? _b2 : "10%"
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
WalletTypeIcon
|
|
45
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { CpslIcon } from "@getpara/react-components";
|
|
6
|
+
import { safeStyled } from "../utils/index.js";
|
|
7
|
+
const BannerContainer = safeStyled.div`
|
|
8
|
+
background: #fffcec;
|
|
9
|
+
border: 2px solid var(--cpsl-color-utility-yellow);
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
padding: 8px 8px;
|
|
12
|
+
`;
|
|
13
|
+
const Content = safeStyled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
gap: 8px;
|
|
17
|
+
position: relative;
|
|
18
|
+
`;
|
|
19
|
+
const Text = safeStyled.div`
|
|
20
|
+
flex: 1;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
line-height: 1.4;
|
|
23
|
+
color: var(--cpsl-color-black);
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
`;
|
|
26
|
+
const CloseButton = safeStyled.button`
|
|
27
|
+
background-color: transparent;
|
|
28
|
+
border: none;
|
|
29
|
+
padding: 0;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
width: 20px;
|
|
36
|
+
height: 20px;
|
|
37
|
+
margin-top: 1px;
|
|
38
|
+
`;
|
|
39
|
+
const CloseIcon = safeStyled(CpslIcon)`
|
|
40
|
+
--icon-color: var(--cpsl-color-utility-yellow);
|
|
41
|
+
--height: 20px;
|
|
42
|
+
--width: 20px;
|
|
43
|
+
`;
|
|
44
|
+
const WarningBanner = ({ children, onClose }) => {
|
|
45
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
46
|
+
const handleClose = () => {
|
|
47
|
+
setIsVisible(false);
|
|
48
|
+
onClose == null ? void 0 : onClose();
|
|
49
|
+
};
|
|
50
|
+
if (!isVisible) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ jsx(BannerContainer, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(CloseButton, { onClick: handleClose, "aria-label": "Close warning", children: /* @__PURE__ */ jsx(CloseIcon, { icon: "x" }) }),
|
|
55
|
+
/* @__PURE__ */ jsx(Text, { children })
|
|
56
|
+
] }) });
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
WarningBanner
|
|
60
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export declare const defaultCosmosExternalWallet: {
|
|
|
4
4
|
chains: any[];
|
|
5
5
|
chainId: any;
|
|
6
6
|
disconnect: () => Promise<void>;
|
|
7
|
+
disconnectStatus: string;
|
|
7
8
|
switchChain: () => Promise<void>;
|
|
8
9
|
connectParaEmbedded: () => Promise<{}>;
|
|
9
10
|
signMessage: () => Promise<{}>;
|
|
@@ -20,6 +21,7 @@ export declare const defaultEvmExternalWallet: {
|
|
|
20
21
|
avatar: any;
|
|
21
22
|
balance: any;
|
|
22
23
|
disconnect: () => Promise<void>;
|
|
24
|
+
disconnectStatus: string;
|
|
23
25
|
switchChain: () => Promise<void>;
|
|
24
26
|
connectParaEmbedded: () => Promise<{}>;
|
|
25
27
|
signMessage: () => Promise<{}>;
|
|
@@ -28,14 +30,21 @@ export declare const defaultEvmExternalWallet: {
|
|
|
28
30
|
requestInfo: () => Promise<ExternalWalletInfo>;
|
|
29
31
|
disconnectBase: () => Promise<void>;
|
|
30
32
|
useAccount: () => any;
|
|
31
|
-
farcasterStatus:
|
|
33
|
+
farcasterStatus: {
|
|
34
|
+
isPresent: false;
|
|
35
|
+
};
|
|
36
|
+
verificationStage: any;
|
|
32
37
|
};
|
|
33
38
|
export declare const defaultSolanaExternalWallet: {
|
|
34
39
|
wallets: any[];
|
|
35
40
|
disconnect: () => Promise<void>;
|
|
41
|
+
disconnectStatus: string;
|
|
36
42
|
signMessage: () => Promise<{}>;
|
|
37
43
|
signVerificationMessage: () => Promise<{}>;
|
|
38
44
|
requestInfo: () => Promise<ExternalWalletInfo>;
|
|
39
45
|
disconnectBase: () => Promise<void>;
|
|
40
46
|
useWallet: () => any;
|
|
47
|
+
farcasterStatus: {
|
|
48
|
+
isPresent: false;
|
|
49
|
+
};
|
|
41
50
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
3
|
const defaultCosmosExternalWallet = {
|
|
4
4
|
wallets: [],
|
|
5
5
|
chains: [],
|
|
6
6
|
chainId: void 0,
|
|
7
7
|
disconnect: () => Promise.resolve(),
|
|
8
|
+
disconnectStatus: "idle",
|
|
8
9
|
switchChain: () => Promise.resolve(),
|
|
9
10
|
connectParaEmbedded: () => Promise.resolve({}),
|
|
10
11
|
signMessage: () => Promise.resolve({}),
|
|
@@ -21,6 +22,7 @@ const defaultEvmExternalWallet = {
|
|
|
21
22
|
avatar: void 0,
|
|
22
23
|
balance: void 0,
|
|
23
24
|
disconnect: () => Promise.resolve(),
|
|
25
|
+
disconnectStatus: "idle",
|
|
24
26
|
switchChain: () => Promise.resolve(),
|
|
25
27
|
connectParaEmbedded: () => Promise.resolve({}),
|
|
26
28
|
signMessage: () => Promise.resolve({}),
|
|
@@ -29,16 +31,19 @@ const defaultEvmExternalWallet = {
|
|
|
29
31
|
requestInfo: () => Promise.resolve({}),
|
|
30
32
|
disconnectBase: () => Promise.resolve(),
|
|
31
33
|
useAccount: () => void 0,
|
|
32
|
-
farcasterStatus:
|
|
34
|
+
farcasterStatus: { isPresent: false },
|
|
35
|
+
verificationStage: void 0
|
|
33
36
|
};
|
|
34
37
|
const defaultSolanaExternalWallet = {
|
|
35
38
|
wallets: [],
|
|
36
39
|
disconnect: () => Promise.resolve(),
|
|
40
|
+
disconnectStatus: "idle",
|
|
37
41
|
signMessage: () => Promise.resolve({}),
|
|
38
42
|
signVerificationMessage: () => Promise.resolve({}),
|
|
39
43
|
requestInfo: () => Promise.resolve({}),
|
|
40
44
|
disconnectBase: () => Promise.resolve(),
|
|
41
|
-
useWallet: () => void 0
|
|
45
|
+
useWallet: () => void 0,
|
|
46
|
+
farcasterStatus: { isPresent: false }
|
|
42
47
|
};
|
|
43
48
|
export {
|
|
44
49
|
defaultCosmosExternalWallet,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TNetwork, TOnRampAsset, OnRampMethod, OnRampProvider, TWalletType } from '@getpara/core-sdk';
|
|
2
|
+
import { IconType } from '@getpara/react-components';
|
|
3
|
+
import { Transition, Variants } from 'framer-motion';
|
|
4
|
+
import { DisplayMetadata } from '../types/commonTypes.js';
|
|
5
|
+
export declare const PARA_CONNECT = "https://connect.getpara.com/";
|
|
6
|
+
export declare const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
|
|
7
|
+
export type OnRampProviderConfig = DisplayMetadata & {
|
|
8
|
+
feeLower: number;
|
|
9
|
+
feeUpper?: number;
|
|
10
|
+
methods: OnRampMethod[];
|
|
11
|
+
backgroundColors: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const ON_RAMP_PROVIDERS: Record<OnRampProvider, OnRampProviderConfig>;
|
|
14
|
+
type Networks = Record<TNetwork, DisplayMetadata>;
|
|
15
|
+
export declare const WALLET_TYPES_METADATA: Record<TWalletType, DisplayMetadata>;
|
|
16
|
+
export declare const NETWORKS: Networks;
|
|
17
|
+
export declare const ON_RAMP_ASSETS: Record<TOnRampAsset, {
|
|
18
|
+
name: string;
|
|
19
|
+
code: string;
|
|
20
|
+
icon: IconType;
|
|
21
|
+
isCircular?: boolean;
|
|
22
|
+
isDark?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function getNetworkName(str: TNetwork | string): string;
|
|
25
|
+
export declare function getNetworkIcon(str: TNetwork | string): IconType;
|
|
26
|
+
export declare function getAssetCode(str: TOnRampAsset | string): string;
|
|
27
|
+
export declare function getAssetName(str: TOnRampAsset | string): string;
|
|
28
|
+
export declare function getAssetIcon(str: TOnRampAsset | string): "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowCircleDown" | "arrowNarrow" | "arrowUpDown" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "beraBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "close" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "coins" | "copy07" | "copy" | "cosmosCircle" | "cosmos" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "discord" | "dot" | "dotsSquare" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "externalLink" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "farcaster" | "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" | "key" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraArrow" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "para" | "passcode" | "phantom" | "phone" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "safe" | "samsung" | "search" | "send" | "settings" | "share" | "shield" | "shuffle" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solana" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "telegram" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "user01" | "userCircle" | "userPlus" | "user" | "valora" | "wallet02" | "walletConnect" | "wallet" | "x" | "youtubeBrand" | "youtube" | "zap" | "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";
|
|
29
|
+
export declare const MOBILE_SIZE = 480;
|
|
30
|
+
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
31
|
+
export declare const EMAIL_REGEX: RegExp;
|
|
32
|
+
export declare const BODY_MOTION_VARIANTS: Variants;
|
|
33
|
+
export declare const BODY_TRANSITION: Transition;
|
|
34
|
+
export declare const SDK_VERSION: string;
|
|
35
|
+
export * from './aaguiMetadata.js';
|
|
36
|
+
export * from './externalWalletDefaults.js';
|
|
37
|
+
export * from './oAuthLogos.js';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-MMUBH76A.js";
|
|
6
|
+
var _a;
|
|
7
|
+
import { OnRampMethod, OnRampProvider } from "@getpara/core-sdk";
|
|
8
|
+
const PARA_CONNECT = "https://connect.getpara.com/";
|
|
9
|
+
const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
|
|
10
|
+
const ON_RAMP_PROVIDERS = {
|
|
11
|
+
[OnRampProvider.STRIPE]: {
|
|
12
|
+
name: "Stripe",
|
|
13
|
+
feeLower: 0.99,
|
|
14
|
+
feeUpper: 4.49,
|
|
15
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
16
|
+
icon: "stripeBrand",
|
|
17
|
+
backgroundColors: ["#6772E5", "#808AF4"]
|
|
18
|
+
},
|
|
19
|
+
[OnRampProvider.RAMP]: {
|
|
20
|
+
name: "Ramp",
|
|
21
|
+
feeLower: 0.99,
|
|
22
|
+
feeUpper: 4.49,
|
|
23
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
24
|
+
icon: "rampNetworkBrand",
|
|
25
|
+
backgroundColors: ["#21BF73", "#3AE492"]
|
|
26
|
+
},
|
|
27
|
+
[OnRampProvider.MOONPAY]: {
|
|
28
|
+
name: "MoonPay",
|
|
29
|
+
feeLower: 1,
|
|
30
|
+
feeUpper: 4.5,
|
|
31
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
32
|
+
icon: "moonpayBrand",
|
|
33
|
+
backgroundColors: ["#7715F5", "#9647fd"]
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const ICON_TYPES = {
|
|
37
|
+
ethereum: { isDark: true },
|
|
38
|
+
usdcBrand: { isCircular: true },
|
|
39
|
+
arbitrumBrand: { isCircular: true },
|
|
40
|
+
baseBrand: { isCircular: true },
|
|
41
|
+
optimismBrand: { isCircular: true },
|
|
42
|
+
cosmos: { isCircular: true, isDark: true },
|
|
43
|
+
celoBrand: { isCircular: true },
|
|
44
|
+
tetherBrand: { isCircular: true }
|
|
45
|
+
};
|
|
46
|
+
const WALLET_TYPES_METADATA = {
|
|
47
|
+
EVM: { name: "EVM", icon: "ethCircle", isCircular: true },
|
|
48
|
+
SOLANA: { name: "Solana", icon: "solana" },
|
|
49
|
+
COSMOS: { name: "Cosmos", icon: "cosmos", isCircular: true, isDark: true }
|
|
50
|
+
};
|
|
51
|
+
const NETWORKS = Object.entries({
|
|
52
|
+
["ETHEREUM"]: { name: "Ethereum", icon: "ethereum" },
|
|
53
|
+
["SEPOLIA"]: { name: "Sepolia", icon: "ethereum" },
|
|
54
|
+
["ARBITRUM"]: { name: "Arbitrum", icon: "arbitrumBrand" },
|
|
55
|
+
["BASE"]: { name: "Base", icon: "baseBrand" },
|
|
56
|
+
["OPTIMISM"]: { name: "Optimism", icon: "optimismBrand" },
|
|
57
|
+
["POLYGON"]: { name: "Polygon", icon: "polygonBrand" },
|
|
58
|
+
["SOLANA"]: { name: "Solana", icon: "solana" },
|
|
59
|
+
["COSMOS"]: { name: "Cosmos", icon: "cosmos" },
|
|
60
|
+
["CELO"]: { name: "Celo", icon: "celoBrand" },
|
|
61
|
+
["SOLANA_DEVNET"]: { name: "Solana Devnet", icon: "solana" },
|
|
62
|
+
["NOBLE"]: { name: "Noble", icon: "nobleBrand" },
|
|
63
|
+
["BERACHAIN"]: { name: "Berachain", icon: "beraBrand" }
|
|
64
|
+
}).reduce((acc, [key, entry]) => {
|
|
65
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
66
|
+
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
67
|
+
});
|
|
68
|
+
}, {});
|
|
69
|
+
const ON_RAMP_ASSETS = Object.entries({
|
|
70
|
+
["ETHEREUM"]: { name: "Ethereum", code: "ETH", icon: "ethereum" },
|
|
71
|
+
["USDC"]: { name: "USD Coin", code: "USDC", icon: "usdcBrand" },
|
|
72
|
+
["POLYGON"]: { name: "Polygon", code: "POL", icon: "polygonBrand" },
|
|
73
|
+
["SOLANA"]: { name: "Solana", code: "SOL", icon: "solana" },
|
|
74
|
+
["ATOM"]: { name: "Atom", code: "ATOM", icon: "cosmos" },
|
|
75
|
+
["CELO"]: { name: "Celo", code: "CELO", icon: "celoBrand" },
|
|
76
|
+
["TETHER"]: { name: "Tether", code: "USDT", icon: "tetherBrand" },
|
|
77
|
+
["CUSD"]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
|
|
78
|
+
["CEUR"]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
|
|
79
|
+
["CREAL"]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" },
|
|
80
|
+
["BERA"]: { name: "Berachain", code: "BERA", icon: "beraBrand" }
|
|
81
|
+
}).reduce((acc, [key, entry]) => {
|
|
82
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
83
|
+
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
84
|
+
});
|
|
85
|
+
}, {});
|
|
86
|
+
function getNetworkName(str) {
|
|
87
|
+
var _a2, _b;
|
|
88
|
+
return (_b = (_a2 = NETWORKS[str]) == null ? void 0 : _a2.name) != null ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
|
|
89
|
+
}
|
|
90
|
+
function getNetworkIcon(str) {
|
|
91
|
+
var _a2, _b;
|
|
92
|
+
return (_b = (_a2 = NETWORKS[str]) == null ? void 0 : _a2.icon) != null ? _b : "globe";
|
|
93
|
+
}
|
|
94
|
+
function getAssetCode(str) {
|
|
95
|
+
var _a2, _b;
|
|
96
|
+
return (_b = (_a2 = ON_RAMP_ASSETS[str]) == null ? void 0 : _a2.code) != null ? _b : str;
|
|
97
|
+
}
|
|
98
|
+
function getAssetName(str) {
|
|
99
|
+
var _a2, _b;
|
|
100
|
+
return (_b = (_a2 = ON_RAMP_ASSETS[str]) == null ? void 0 : _a2.name) != null ? _b : str;
|
|
101
|
+
}
|
|
102
|
+
function getAssetIcon(str) {
|
|
103
|
+
var _a2, _b;
|
|
104
|
+
return (_b = (_a2 = ON_RAMP_ASSETS[str]) == null ? void 0 : _a2.icon) != null ? _b : "emptyCircle";
|
|
105
|
+
}
|
|
106
|
+
const MOBILE_SIZE = 480;
|
|
107
|
+
const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
108
|
+
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
109
|
+
const BODY_MOTION_VARIANTS = {
|
|
110
|
+
enter: (direction) => {
|
|
111
|
+
return {
|
|
112
|
+
scale: direction > 0 ? 0.9 : 1.1,
|
|
113
|
+
opacity: 0
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
center: {
|
|
117
|
+
scale: 1,
|
|
118
|
+
opacity: 1
|
|
119
|
+
},
|
|
120
|
+
exit: (direction) => {
|
|
121
|
+
return {
|
|
122
|
+
scale: direction < 0 ? 0.9 : 1.1,
|
|
123
|
+
opacity: 0
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const BODY_TRANSITION = {
|
|
128
|
+
duration: 0.2
|
|
129
|
+
};
|
|
130
|
+
const SDK_VERSION = (_a = process.env.PARA_REACT_SDK_VERSION) != null ? _a : "";
|
|
131
|
+
export * from "./aaguiMetadata.js";
|
|
132
|
+
export * from "./externalWalletDefaults.js";
|
|
133
|
+
export * from "./oAuthLogos.js";
|
|
134
|
+
export {
|
|
135
|
+
BODY_MOTION_VARIANTS,
|
|
136
|
+
BODY_TRANSITION,
|
|
137
|
+
EMAIL_REGEX,
|
|
138
|
+
MOBILE_SIZE,
|
|
139
|
+
NETWORKS,
|
|
140
|
+
NETWORK_NOT_SUPPORTED_ERROR,
|
|
141
|
+
ON_RAMP_ASSETS,
|
|
142
|
+
ON_RAMP_PROVIDERS,
|
|
143
|
+
PARA_CONNECT,
|
|
144
|
+
PARA_TERMS_AND_CONDITIONS,
|
|
145
|
+
SDK_VERSION,
|
|
146
|
+
WALLET_TYPES_METADATA,
|
|
147
|
+
getAssetCode,
|
|
148
|
+
getAssetIcon,
|
|
149
|
+
getAssetName,
|
|
150
|
+
getNetworkIcon,
|
|
151
|
+
getNetworkName
|
|
152
|
+
};
|
|
@@ -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;
|