@getpara/react-sdk 2.0.0-alpha.29 → 2.0.0-alpha.30
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/cli/cli.mjs +20 -7
- package/dist/modal/ParaModal.js +6 -3
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +61 -55
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +1 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +3 -1
- package/dist/modal/constants/constants.d.ts +1 -1
- package/dist/modal/constants/constants.js +4 -2
- package/dist/provider/ParaProvider.js +1 -1
- package/dist/provider/hooks/queries/useAccount.d.ts +4 -0
- package/dist/provider/hooks/queries/useAccount.js +3 -0
- package/dist/provider/providers/ExternalWalletProvider.js +34 -2
- package/package.json +8 -8
package/dist/cli/cli.mjs
CHANGED
|
@@ -8,12 +8,12 @@ const PACKAGES_TO_STUB = [
|
|
|
8
8
|
'@getpara/evm-wallet-connectors',
|
|
9
9
|
'@getpara/cosmos-wallet-connectors',
|
|
10
10
|
'@getpara/solana-wallet-connectors',
|
|
11
|
+
'@farcaster/miniapp-sdk',
|
|
12
|
+
'@farcaster/miniapp-wagmi-connector',
|
|
11
13
|
];
|
|
12
14
|
|
|
13
15
|
const checkForPackages = async () => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const pathToNodeModules = path.resolve(pathToParaPackages, '../../node_modules');
|
|
16
|
+
const pathToNodeModules = path.resolve('node_modules');
|
|
17
17
|
|
|
18
18
|
for (let i = 0; i < PACKAGES_TO_STUB.length; i++) {
|
|
19
19
|
const packageName = PACKAGES_TO_STUB[i];
|
|
@@ -22,11 +22,24 @@ const checkForPackages = async () => {
|
|
|
22
22
|
} catch (err) {
|
|
23
23
|
if (err.code === 'ERR_MODULE_NOT_FOUND') {
|
|
24
24
|
const packageJsonContent = { name: packageName, main: './index.js' };
|
|
25
|
+
|
|
25
26
|
await fs.mkdir(path.join(pathToNodeModules, packageName), { recursive: true });
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const indexPath = path.join(pathToNodeModules, packageName, 'index.js');
|
|
28
|
+
const packageJsonPath = path.join(pathToNodeModules, packageName, 'package.json');
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
await fs.access(indexPath);
|
|
32
|
+
} catch {
|
|
33
|
+
await fs.writeFile(indexPath, '//STUB');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
await fs.access(packageJsonPath);
|
|
38
|
+
} catch {
|
|
39
|
+
await fs.writeFile(packageJsonPath, JSON.stringify(packageJsonContent), {
|
|
40
|
+
encoding: 'utf-8',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
30
43
|
}
|
|
31
44
|
}
|
|
32
45
|
}
|
package/dist/modal/ParaModal.js
CHANGED
|
@@ -133,6 +133,9 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
133
133
|
}, [hasPreviousStep, currentStep]);
|
|
134
134
|
const initModal = (shouldAutoLogin) => __async(void 0, null, function* () {
|
|
135
135
|
var _a2;
|
|
136
|
+
if (!para.isReady) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
136
139
|
const isAccount = isConnected, isGuest = isAccount && para.isGuestMode || isCreateGuestWalletsPending;
|
|
137
140
|
switch (true) {
|
|
138
141
|
case !!currentStepOverride:
|
|
@@ -177,15 +180,15 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
177
180
|
}
|
|
178
181
|
});
|
|
179
182
|
useEffect(() => {
|
|
180
|
-
if (para && isOpen && !isAccountLoading && !isInitialized.current) {
|
|
183
|
+
if ((para == null ? void 0 : para.isReady) && isOpen && !isAccountLoading && !isInitialized.current) {
|
|
181
184
|
initModal(isOpen);
|
|
182
185
|
isInitialized.current = true;
|
|
183
186
|
}
|
|
184
|
-
if (para && !isOpen && isInitialized.current) {
|
|
187
|
+
if ((para == null ? void 0 : para.isReady) && !isOpen && isInitialized.current) {
|
|
185
188
|
initModal();
|
|
186
189
|
isInitialized.current = false;
|
|
187
190
|
}
|
|
188
|
-
}, [para, isOpen, isAccountLoading]);
|
|
191
|
+
}, [para == null ? void 0 : para.isReady, isOpen, isAccountLoading]);
|
|
189
192
|
useEffect(() => {
|
|
190
193
|
let _authLayout = authLayout;
|
|
191
194
|
if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
|
|
@@ -14,12 +14,14 @@ import { useExternalWallets } from "../../../provider/providers/ExternalWalletPr
|
|
|
14
14
|
import { useStore } from "../../../provider/stores/useStore.js";
|
|
15
15
|
import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
|
|
16
16
|
import { useAccount } from "../../../provider/index.js";
|
|
17
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
17
18
|
const AuthMainStepContent = ({
|
|
18
19
|
oAuthMethods,
|
|
19
20
|
disableEmailLogin,
|
|
20
21
|
disablePhoneLogin,
|
|
21
22
|
isGuestModeEnabled = false
|
|
22
23
|
}) => {
|
|
24
|
+
const para = useInternalClient();
|
|
23
25
|
const { wallets } = useExternalWallets();
|
|
24
26
|
const { createGuestWallets } = useAuthActions();
|
|
25
27
|
const { embedded } = useAccount();
|
|
@@ -41,69 +43,73 @@ const AuthMainStepContent = ({
|
|
|
41
43
|
};
|
|
42
44
|
const Content = useMemo(() => {
|
|
43
45
|
const methods = [];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
46
|
+
if (para.isFarcasterMiniApp) {
|
|
47
|
+
methods.push([/* @__PURE__ */ jsx(ExternalWallets, {}, "externalWallets"), "EXTERNAL:FULL"]);
|
|
48
|
+
} else {
|
|
49
|
+
authLayout == null ? void 0 : authLayout.forEach((layout) => {
|
|
50
|
+
switch (layout) {
|
|
51
|
+
case AuthLayout.AUTH_FULL: {
|
|
52
|
+
methods.push([
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
AuthOptions,
|
|
55
|
+
{
|
|
56
|
+
oAuthMethods,
|
|
57
|
+
disableEmailLogin,
|
|
58
|
+
disablePhoneLogin,
|
|
59
|
+
isGuestModeEnabled
|
|
60
|
+
},
|
|
61
|
+
"authFull"
|
|
62
|
+
),
|
|
63
|
+
layout
|
|
64
|
+
]);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
case AuthLayout.AUTH_CONDENSED: {
|
|
68
|
+
const icons = [];
|
|
69
|
+
oAuthMethods == null ? void 0 : oAuthMethods.forEach((method) => icons.push(ACCOUNT_TYPES[method][useBrandedLogos ? "logoBranded" : "logo"]));
|
|
70
|
+
methods.push([
|
|
71
|
+
/* @__PURE__ */ jsxs(CondensedButton, { onClick: handleCondensedAuthClick, variant: "tertiary", fullWidth: true, children: [
|
|
72
|
+
/* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
73
|
+
"Sign Up or Login",
|
|
74
|
+
/* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
|
|
75
|
+
] }, "authCondensed"),
|
|
76
|
+
layout
|
|
77
|
+
]);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case AuthLayout.EXTERNAL_FULL: {
|
|
81
|
+
if (!!wallets.length) {
|
|
82
|
+
methods.push([/* @__PURE__ */ jsx(ExternalWallets, {}, "externalWallets"), layout]);
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case AuthLayout.EXTERNAL_CONDENSED: {
|
|
87
|
+
const icons = [];
|
|
88
|
+
wallets == null ? void 0 : wallets.forEach((wallet) => icons.push(wallet.iconUrl));
|
|
89
|
+
methods.push([
|
|
90
|
+
/* @__PURE__ */ jsxs(CondensedButton, { onClick: handleCondensedExternalClick, variant: "tertiary", fullWidth: true, children: [
|
|
91
|
+
/* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
92
|
+
"Connect Wallet",
|
|
93
|
+
/* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
|
|
94
|
+
] }, "authCondensed"),
|
|
95
|
+
layout
|
|
96
|
+
]);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
100
|
+
break;
|
|
78
101
|
}
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case AuthLayout.EXTERNAL_CONDENSED: {
|
|
82
|
-
const icons = [];
|
|
83
|
-
wallets == null ? void 0 : wallets.forEach((wallet) => icons.push(wallet.iconUrl));
|
|
84
|
-
methods.push([
|
|
85
|
-
/* @__PURE__ */ jsxs(CondensedButton, { onClick: handleCondensedExternalClick, variant: "tertiary", fullWidth: true, children: [
|
|
86
|
-
/* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
87
|
-
"Connect Wallet",
|
|
88
|
-
/* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
|
|
89
|
-
] }, "authCondensed"),
|
|
90
|
-
layout
|
|
91
|
-
]);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
default: {
|
|
95
|
-
break;
|
|
96
102
|
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
99
105
|
return /* @__PURE__ */ jsx(Fragment, { children: methods.map(([reactNode, key], index) => /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
100
106
|
reactNode,
|
|
101
107
|
methods.length > 1 && index < methods.length - 1 && /* @__PURE__ */ jsx(CpslDivider, { children: "or" }, "or")
|
|
102
108
|
] }, key)) });
|
|
103
|
-
}, [oAuthMethods, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, wallets, authLayout]);
|
|
109
|
+
}, [para.isFarcasterMiniApp, oAuthMethods, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, wallets, authLayout]);
|
|
104
110
|
return /* @__PURE__ */ jsxs(Container, { "data-testid": "main-auth-step-content", children: [
|
|
105
111
|
Content,
|
|
106
|
-
isGuestModeEnabled && !isGuestMode && /* @__PURE__ */ jsx(
|
|
112
|
+
isGuestModeEnabled && !isGuestMode && !para.isFarcasterMiniApp && /* @__PURE__ */ jsx(
|
|
107
113
|
GuestMode,
|
|
108
114
|
{
|
|
109
115
|
href: "#",
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js
CHANGED
|
@@ -29,7 +29,7 @@ const ExternalWalletNetworkSelectStep = () => {
|
|
|
29
29
|
}
|
|
30
30
|
setSelectedExternalWalletId(wallet.internalId);
|
|
31
31
|
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
32
|
-
if (wallet.installed) {
|
|
32
|
+
if (wallet.installed || wallet.internalId === "FARCASTER") {
|
|
33
33
|
connectExternalWallet(wallet);
|
|
34
34
|
} else if (wallet.isMobile) {
|
|
35
35
|
connectExternalWallet(wallet, true);
|
|
@@ -11,8 +11,10 @@ import { ModalStep } from "../../utils/steps.js";
|
|
|
11
11
|
import { useState } from "react";
|
|
12
12
|
import { hasEmbeddedAuth } from "../../utils/authLayoutHelpers.js";
|
|
13
13
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
14
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
14
15
|
const HAS_MORE_LENGTH = 3;
|
|
15
16
|
const ExternalWallets = () => {
|
|
17
|
+
const para = useInternalClient();
|
|
16
18
|
const { wallets: allWallets, connectExternalWallet } = useExternalWallets();
|
|
17
19
|
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
18
20
|
const setStep = useModalStore((state) => state.setStep);
|
|
@@ -21,7 +23,7 @@ const ExternalWallets = () => {
|
|
|
21
23
|
const [search, setSearch] = useState("");
|
|
22
24
|
const dedupedWallets = Array.from(new Set(allWallets.map((wallet) => wallet.id))).map((id) => {
|
|
23
25
|
return allWallets.find((wallet) => wallet.id === id);
|
|
24
|
-
});
|
|
26
|
+
}).filter((wallet) => !para.isFarcasterMiniApp || wallet.internalId === "FARCASTER");
|
|
25
27
|
const hasMore = dedupedWallets.length > HAS_MORE_LENGTH;
|
|
26
28
|
const walletsToShow = showAll || !hasMore ? search ? dedupedWallets.filter((w) => w.name.toLowerCase().includes(search.toLowerCase())) : dedupedWallets : dedupedWallets.slice(0, HAS_MORE_LENGTH);
|
|
27
29
|
const showMoreButton = !showAll && hasMore;
|
|
@@ -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" | "wallet" | "cosmos" | "solana" | "para" | "walletConnect" | "close" | "copy" | "safe" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "userPlus" | "user" | "valora" | "youtubeBrand" | "youtube" | "zerion" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
|
|
33
|
+
export declare function getAssetIcon(str: OnRampAsset | string): "key" | "phone" | "farcaster" | "telegram" | "discord" | "x" | "search" | "wallet" | "cosmos" | "solana" | "para" | "walletConnect" | "close" | "copy" | "safe" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "beraBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "userPlus" | "user" | "valora" | "youtubeBrand" | "youtube" | "zerion" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
|
|
34
34
|
export declare const MOBILE_SIZE = 480;
|
|
35
35
|
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
36
36
|
export declare const EMAIL_REGEX: RegExp;
|
|
@@ -53,7 +53,8 @@ const NETWORKS = Object.entries({
|
|
|
53
53
|
[Network.COSMOS]: { name: "Cosmos", icon: "cosmos" },
|
|
54
54
|
[Network.CELO]: { name: "Celo", icon: "celoBrand" },
|
|
55
55
|
[Network.SOLANA_DEVNET]: { name: "Solana Devnet", icon: "solana" },
|
|
56
|
-
[Network.NOBLE]: { name: "Noble", icon: "nobleBrand" }
|
|
56
|
+
[Network.NOBLE]: { name: "Noble", icon: "nobleBrand" },
|
|
57
|
+
[Network.BERACHAIN]: { name: "Berachain", icon: "beraBrand" }
|
|
57
58
|
}).reduce((acc, [key, entry]) => {
|
|
58
59
|
return __spreadProps(__spreadValues({}, acc), {
|
|
59
60
|
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
@@ -69,7 +70,8 @@ const ON_RAMP_ASSETS = Object.entries({
|
|
|
69
70
|
[OnRampAsset.TETHER]: { name: "Tether", code: "USDT", icon: "tetherBrand" },
|
|
70
71
|
[OnRampAsset.CUSD]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
|
|
71
72
|
[OnRampAsset.CEUR]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
|
|
72
|
-
[OnRampAsset.CREAL]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" }
|
|
73
|
+
[OnRampAsset.CREAL]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" },
|
|
74
|
+
[OnRampAsset.BERA]: { name: "Berachain", code: "BERA", icon: "beraBrand" }
|
|
73
75
|
}).reduce((acc, [key, entry]) => {
|
|
74
76
|
return __spreadProps(__spreadValues({}, acc), {
|
|
75
77
|
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
@@ -107,7 +107,7 @@ const ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config
|
|
|
107
107
|
},
|
|
108
108
|
children: /* @__PURE__ */ jsx(ExternalWalletWrapper, { config: externalWalletConfig, children: /* @__PURE__ */ jsxs(AccountLinkProvider, { children: [
|
|
109
109
|
children,
|
|
110
|
-
!config.disableEmbeddedModal && /* @__PURE__ */ jsx(ParaModal, { ref })
|
|
110
|
+
!config.disableEmbeddedModal && client.isReady && /* @__PURE__ */ jsx(ParaModal, { ref })
|
|
111
111
|
] }) })
|
|
112
112
|
}
|
|
113
113
|
);
|
|
@@ -25,6 +25,10 @@ type ExternalNetwork = 'evm' | 'cosmos' | 'solana';
|
|
|
25
25
|
* - `solana`: The connected Solana wallet adapter, with only allowed properties included.
|
|
26
26
|
*/
|
|
27
27
|
export type UseAccountReturn = {
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether the client's first-time setup is complete.
|
|
30
|
+
*/
|
|
31
|
+
isReady: boolean;
|
|
28
32
|
/**
|
|
29
33
|
* Indicates whether there is a wallet connected (either embedded, external or both).
|
|
30
34
|
*/
|
|
@@ -56,6 +56,7 @@ const useAccount = ({ cosmos } = {}) => {
|
|
|
56
56
|
enabled: isSuccess && !!client,
|
|
57
57
|
queryKey: [ACCOUNT_BASE_KEY, isFullyLoggedIn != null ? isFullyLoggedIn : null, client == null ? void 0 : client.userId, evmQueryKeys, cosmosQueryKeys, solanaQueryKeys],
|
|
58
58
|
queryFn: () => __async(void 0, null, function* () {
|
|
59
|
+
const isReady = client.isReady;
|
|
59
60
|
const paraAccount = yield getEmbeddedAccount(client);
|
|
60
61
|
let connectionType = "none";
|
|
61
62
|
if (paraAccount.isConnected) {
|
|
@@ -79,6 +80,7 @@ const useAccount = ({ cosmos } = {}) => {
|
|
|
79
80
|
connectedNetworks.push("solana");
|
|
80
81
|
}
|
|
81
82
|
return {
|
|
83
|
+
isReady,
|
|
82
84
|
isConnected: paraAccount.isConnected,
|
|
83
85
|
connectionType,
|
|
84
86
|
embedded: __spreadProps(__spreadValues({}, paraAccount), { isConnected: isEmbeddedConnected }),
|
|
@@ -103,6 +105,7 @@ const useAccount = ({ cosmos } = {}) => {
|
|
|
103
105
|
})
|
|
104
106
|
});
|
|
105
107
|
const defaultResp = {
|
|
108
|
+
isReady: false,
|
|
106
109
|
isConnected: false,
|
|
107
110
|
connectionType: "none",
|
|
108
111
|
isLoading,
|
|
@@ -73,7 +73,8 @@ function ExternalWalletProvider({ children }) {
|
|
|
73
73
|
signVerificationMessage: evmSignVerificationMessage,
|
|
74
74
|
getWalletBalance: evmGetWalletBalance,
|
|
75
75
|
requestInfo: evmRequestInfo,
|
|
76
|
-
disconnectBase: evmDisconnectBase
|
|
76
|
+
disconnectBase: evmDisconnectBase,
|
|
77
|
+
farcasterStatus: evmFarcasterStatus
|
|
77
78
|
} = useContext(evmContext);
|
|
78
79
|
const {
|
|
79
80
|
wallets: solanaWallets,
|
|
@@ -111,7 +112,9 @@ function ExternalWalletProvider({ children }) {
|
|
|
111
112
|
const [qrUri, setQrUri] = useState();
|
|
112
113
|
const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
|
|
113
114
|
const [isSigningMessage, setIsSigningMessage] = useState(false);
|
|
114
|
-
const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter(
|
|
115
|
+
const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter(
|
|
116
|
+
(w) => (w.internalId !== "FARCASTER" || (para == null ? void 0 : para.isFarcasterMiniApp)) && externalWallets.includes(w.id.toUpperCase())
|
|
117
|
+
).sort(
|
|
115
118
|
(a, b) => externalWallets.indexOf(a.id.toUpperCase()) - externalWallets.indexOf(b.id.toUpperCase())
|
|
116
119
|
).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
|
|
117
120
|
const wallet = useMemo(
|
|
@@ -501,6 +504,35 @@ function ExternalWalletProvider({ children }) {
|
|
|
501
504
|
yield connectEmbeddedToExternalConnectors();
|
|
502
505
|
});
|
|
503
506
|
}, [connectEmbeddedToExternalConnectors]);
|
|
507
|
+
useEffect(() => {
|
|
508
|
+
function loginFarcasterMiniApp() {
|
|
509
|
+
return __async(this, null, function* () {
|
|
510
|
+
if (para.isReady && para.isFarcasterMiniApp) {
|
|
511
|
+
const isEvm = para.supportedWalletTypes.some(({ type }) => type === "EVM");
|
|
512
|
+
const isAwaitingEvmLogin = isEvm && (evmFarcasterStatus == null ? void 0 : evmFarcasterStatus.isConnected) && !Object.values(para.externalWallets || {}).some(
|
|
513
|
+
(w) => w.type === "EVM" && w.externalProviderId === "FARCASTER" && w.address === evmFarcasterStatus.address
|
|
514
|
+
);
|
|
515
|
+
const isAwaitingLogin = isAwaitingEvmLogin;
|
|
516
|
+
if (isAwaitingLogin) {
|
|
517
|
+
yield para.loginExternalWallet({
|
|
518
|
+
externalWallet: [
|
|
519
|
+
...isAwaitingEvmLogin ? [
|
|
520
|
+
{
|
|
521
|
+
type: "EVM",
|
|
522
|
+
provider: "Farcaster",
|
|
523
|
+
providerId: "FARCASTER",
|
|
524
|
+
address: evmFarcasterStatus.address,
|
|
525
|
+
isConnectionOnly: true
|
|
526
|
+
}
|
|
527
|
+
] : []
|
|
528
|
+
]
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
loginFarcasterMiniApp();
|
|
535
|
+
}, [para.isReady, para.isFarcasterMiniApp, evmFarcasterStatus]);
|
|
504
536
|
return /* @__PURE__ */ jsx(
|
|
505
537
|
ExternalWalletContext.Provider,
|
|
506
538
|
{
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.30",
|
|
4
4
|
"bin": {
|
|
5
5
|
"setup-para": "dist/cli/cli.mjs"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
9
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
10
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
8
|
+
"@getpara/react-common": "2.0.0-alpha.30",
|
|
9
|
+
"@getpara/react-components": "2.0.0-alpha.30",
|
|
10
|
+
"@getpara/web-sdk": "2.0.0-alpha.30",
|
|
11
11
|
"date-fns": "^3.6.0",
|
|
12
12
|
"framer-motion": "^11.3.31",
|
|
13
13
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"zustand-sync-tabs": "^0.2.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.
|
|
20
|
-
"@getpara/evm-wallet-connectors": "2.0.0-alpha.
|
|
21
|
-
"@getpara/solana-wallet-connectors": "2.0.0-alpha.
|
|
19
|
+
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.30",
|
|
20
|
+
"@getpara/evm-wallet-connectors": "2.0.0-alpha.30",
|
|
21
|
+
"@getpara/solana-wallet-connectors": "2.0.0-alpha.30",
|
|
22
22
|
"@tanstack/react-query": "^5.74.0",
|
|
23
23
|
"@testing-library/dom": "^10.4.0",
|
|
24
24
|
"@testing-library/react": "^16.3.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"package.json",
|
|
39
39
|
"styles.css"
|
|
40
40
|
],
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "8b06219b9c248a3fbdbd05dc7501e8042c369301",
|
|
42
42
|
"main": "dist/index.js",
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@getpara/cosmos-wallet-connectors": "^2.0.0-alpha.26",
|