@getpara/react-sdk-lite 2.0.0-dev.7 → 2.0.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/dist/cli/cli.mjs +26 -1
- package/dist/modal/ParaModal.js +16 -10
- package/dist/modal/components/Account/Account.js +42 -4
- package/dist/modal/components/Account/AccountHeader.js +10 -16
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
- package/dist/modal/components/Account/AccountProfile.js +82 -210
- package/dist/modal/components/Account/AccountProfileEntry.d.ts +12 -0
- package/dist/modal/components/Account/AccountProfileEntry.js +220 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +15 -4
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.js +94 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.js +343 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.js +53 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.js +56 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.d.ts +5 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.js +36 -0
- package/dist/modal/components/Account/AccountSend/context.d.ts +38 -0
- package/dist/modal/components/Account/AccountSend/context.js +418 -0
- package/dist/modal/components/Account/AccountSend/index.d.ts +4 -0
- package/dist/modal/components/Account/AccountSend/index.js +67 -0
- package/dist/modal/components/Account/AccountWallet.d.ts +1 -0
- package/dist/modal/components/Account/AccountWallet.js +133 -0
- package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts} +1 -1
- package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js} +20 -6
- package/dist/modal/components/AddFunds/AddFunds.js +3 -2
- package/dist/modal/components/AddFunds/AddFundsAsset.js +7 -6
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
- package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -2
- package/dist/modal/components/AddFunds/AddFundsSettings.js +13 -54
- package/dist/modal/components/AddFunds/common.d.ts +0 -14
- package/dist/modal/components/AddFunds/common.js +1 -8
- package/dist/modal/components/AuthInput/AuthInput.js +2 -2
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +3 -2
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +8 -33
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
- package/dist/modal/components/Body/Body.js +81 -48
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +8 -5
- package/dist/modal/components/Controls/ChainSelect.js +1 -2
- package/dist/modal/components/Controls/Controls.js +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +5 -1
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +48 -19
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +5 -2
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +63 -33
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +3 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +22 -12
- package/dist/modal/components/Footer/Footer.js +4 -5
- package/dist/modal/components/Header/Header.js +1 -2
- package/dist/modal/components/Header/hooks/useStepTitle.js +53 -38
- package/dist/modal/components/Hero/Hero.js +5 -3
- package/dist/modal/components/IFrameStep/IFrameStep.js +13 -12
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +4 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +6 -5
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +6 -5
- package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -2
- package/dist/modal/components/QuantityInput.d.ts +9 -0
- package/dist/modal/components/QuantityInput.js +91 -0
- package/dist/modal/components/SearchableButtonList.d.ts +34 -0
- package/dist/modal/components/SearchableButtonList.js +223 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +4 -1
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +13 -2
- package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
- package/dist/modal/components/Waiting/Waiting.js +7 -2
- package/dist/modal/components/WalletCard/WalletCard.js +2 -3
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.d.ts +7 -1
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +33 -12
- package/dist/modal/components/common.d.ts +8 -10
- package/dist/modal/components/common.js +16 -36
- package/dist/modal/hooks/index.d.ts +4 -0
- package/dist/modal/hooks/index.js +5 -0
- package/dist/modal/hooks/useDebounce.d.ts +4 -0
- package/dist/modal/hooks/useDebounce.js +16 -0
- package/dist/modal/hooks/useFarcasterLogin.js +8 -1
- package/dist/modal/hooks/useTelegramLogin.js +4 -0
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/modal/stores/modal/actions.js +9 -2
- package/dist/modal/stores/modal/useModalStore.d.ts +9 -1
- package/dist/modal/stores/modal/useModalStore.js +6 -2
- package/dist/modal/types/modalProps.d.ts +5 -1
- package/dist/modal/utils/authInputHelpers.js +1 -1
- package/dist/modal/utils/countryCodes.js +50 -1
- package/dist/modal/utils/getWalletDisplayName.js +1 -1
- package/dist/modal/utils/openPopup.d.ts +1 -1
- package/dist/modal/utils/openPopup.js +6 -2
- package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
- package/dist/modal/utils/renderTextWithLinks.js +34 -0
- package/dist/modal/utils/steps.d.ts +24 -3
- package/dist/modal/utils/steps.js +51 -5
- package/dist/modal/utils/stringFormatters.d.ts +2 -3
- package/dist/modal/utils/stringFormatters.js +11 -7
- package/dist/modal/utils/validatePortalOrigin.d.ts +2 -0
- package/dist/modal/utils/validatePortalOrigin.js +14 -0
- package/dist/provider/ParaProviderMin.js +13 -5
- package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
- package/dist/provider/actions/getEmbeddedAccount.js +13 -4
- package/dist/provider/actions/index.d.ts +11 -9
- package/dist/provider/actions/index.js +4 -0
- package/dist/provider/components/CosmosWalletWrapper.js +3 -3
- package/dist/provider/components/EvmWalletWrapper.js +3 -3
- package/dist/provider/components/ExternalWalletWrapper.js +7 -1
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +3 -1
- package/dist/provider/hooks/mutations/index.d.ts +2 -0
- package/dist/provider/hooks/mutations/index.js +4 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +42 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.js +59 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +5 -5
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +15 -0
- package/dist/provider/hooks/mutations/useExportPrivateKey.js +32 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +2 -2
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +2 -2
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +8 -2
- package/dist/provider/hooks/mutations/useLogout.d.ts +2 -2
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +57 -0
- package/dist/provider/hooks/mutations/useSwitchWallets.js +30 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +18 -27
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +5 -5
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +14 -11
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +5 -5
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +2 -2
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +2 -0
- package/dist/provider/hooks/queries/useAccount.js +58 -24
- package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
- package/dist/provider/hooks/queries/useProfileBalance.d.ts +29 -0
- package/dist/provider/hooks/queries/useProfileBalance.js +65 -0
- package/dist/provider/hooks/utils/useAssetInfo.d.ts +3 -0
- package/dist/provider/hooks/utils/useAssetInfo.js +21 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +22 -5
- package/dist/provider/hooks/utils/useModal.js +3 -3
- package/dist/provider/hooks/utils/useWalletState.d.ts +2 -1
- package/dist/provider/hooks/utils/useWalletState.js +2 -1
- package/dist/provider/providers/AccountLinkProvider.js +18 -11
- package/dist/provider/providers/AssetsProvider.d.ts +14 -0
- package/dist/provider/providers/AssetsProvider.js +68 -0
- package/dist/provider/providers/AuthProvider.d.ts +4 -0
- package/dist/provider/providers/AuthProvider.js +187 -43
- package/dist/provider/providers/ExternalWalletProvider.d.ts +19 -5
- package/dist/provider/providers/ExternalWalletProvider.js +363 -44
- package/dist/provider/stores/getters.d.ts +2 -2
- package/dist/provider/stores/slices/modal.js +4 -1
- package/dist/provider/stores/types.d.ts +6 -3
- package/package.json +8 -8
- package/dist/modal/constants/constants.d.ts +0 -35
- package/dist/modal/constants/constants.js +0 -148
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__async,
|
|
4
|
+
__spreadProps,
|
|
4
5
|
__spreadValues
|
|
5
6
|
} from "../../chunk-MMUBH76A.js";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
8
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
8
9
|
import { isMobile, truncateAddress } from "@getpara/web-sdk";
|
|
9
10
|
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
10
11
|
import { useStore } from "../stores/useStore.js";
|
|
11
|
-
import { ModalStep } from "../../modal/index.js";
|
|
12
|
+
import { ModalStep, openPopup } from "../../modal/index.js";
|
|
12
13
|
import { useModalStore } from "../../modal/stores/index.js";
|
|
13
14
|
import { useAccount, useModal, useParaStatus, useVerifyExternalWallet, useWalletState } from "../hooks/index.js";
|
|
15
|
+
import {
|
|
16
|
+
openMobileUrl
|
|
17
|
+
} from "@getpara/react-common";
|
|
18
|
+
import { ParaEvent, dispatchEvent } from "@getpara/web-sdk";
|
|
14
19
|
import { useAuthActions } from "./AuthProvider.js";
|
|
15
20
|
import { IS_FULLY_LOGGED_IN_BASE_KEY } from "../hooks/queries/useIsFullyLoggedIn.js";
|
|
16
21
|
import { useQueryClient } from "@tanstack/react-query";
|
|
22
|
+
import { useGoBack } from "../../modal/hooks/useGoBack.js";
|
|
23
|
+
import { validatePortalOrigin } from "../../modal/utils/validatePortalOrigin.js";
|
|
17
24
|
const useWalletDisplayHelpers = (wallet) => {
|
|
18
25
|
const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
|
|
19
26
|
return {
|
|
@@ -36,6 +43,7 @@ const defaultExternalWallet = {
|
|
|
36
43
|
username: void 0,
|
|
37
44
|
avatar: void 0,
|
|
38
45
|
connectExternalWallet: () => Promise.resolve(),
|
|
46
|
+
addAdditionalExternalWallet: () => Promise.resolve(),
|
|
39
47
|
disconnectExternalWallet: () => Promise.resolve(),
|
|
40
48
|
switchChain: () => Promise.resolve(),
|
|
41
49
|
setChainIdSwitchingTo: () => {
|
|
@@ -46,9 +54,12 @@ const defaultExternalWallet = {
|
|
|
46
54
|
isSigningMessage: false,
|
|
47
55
|
getWalletBalance: () => Promise.resolve(void 0),
|
|
48
56
|
requestInfo: (_) => Promise.resolve({}),
|
|
49
|
-
disconnectBase: (_, __) => Promise.resolve(),
|
|
57
|
+
disconnectBase: (_, __, ___) => Promise.resolve(),
|
|
50
58
|
connectFarcasterMiniApp: () => Promise.resolve(),
|
|
51
|
-
verificationStage: void 0
|
|
59
|
+
verificationStage: void 0,
|
|
60
|
+
evmDisconnectStatus: "idle",
|
|
61
|
+
solanaDisconnectStatus: "idle",
|
|
62
|
+
cosmosDisconnectStatus: "idle"
|
|
52
63
|
};
|
|
53
64
|
const ExternalWalletContext = createContext(defaultExternalWallet);
|
|
54
65
|
function ExternalWalletProvider({ children }) {
|
|
@@ -78,7 +89,8 @@ function ExternalWalletProvider({ children }) {
|
|
|
78
89
|
requestInfo: evmRequestInfo,
|
|
79
90
|
disconnectBase: evmDisconnectBase,
|
|
80
91
|
farcasterStatus: evmFarcasterStatus,
|
|
81
|
-
verificationStage: evmVerificationStage
|
|
92
|
+
verificationStage: evmVerificationStage,
|
|
93
|
+
disconnectStatus: evmDisconnectStatus
|
|
82
94
|
} = useContext(evmContext);
|
|
83
95
|
const {
|
|
84
96
|
wallets: solanaWallets,
|
|
@@ -87,7 +99,8 @@ function ExternalWalletProvider({ children }) {
|
|
|
87
99
|
signVerificationMessage: solanaSignVerificationMessage,
|
|
88
100
|
requestInfo: solanaRequestInfo,
|
|
89
101
|
disconnectBase: solanaDisconnectBase,
|
|
90
|
-
farcasterStatus: solanaFarcasterStatus
|
|
102
|
+
farcasterStatus: solanaFarcasterStatus,
|
|
103
|
+
disconnectStatus: solanaDisconnectStatus
|
|
91
104
|
} = useContext(solanaContext);
|
|
92
105
|
const {
|
|
93
106
|
wallets: cosmosWallets,
|
|
@@ -99,7 +112,8 @@ function ExternalWalletProvider({ children }) {
|
|
|
99
112
|
signMessage: cosmosSignMessage,
|
|
100
113
|
signVerificationMessage: cosmosSignVerificationMessage,
|
|
101
114
|
requestInfo: cosmosRequestInfo,
|
|
102
|
-
disconnectBase: cosmosDisconnectBase
|
|
115
|
+
disconnectBase: cosmosDisconnectBase,
|
|
116
|
+
disconnectStatus: cosmosDisconnectStatus
|
|
103
117
|
} = useContext(cosmosContext);
|
|
104
118
|
const onLoginRef = useStore((state) => state.onLoginRef);
|
|
105
119
|
const setStep = useModalStore((state) => state.setStep);
|
|
@@ -116,37 +130,53 @@ function ExternalWalletProvider({ children }) {
|
|
|
116
130
|
const { onNewAuthState } = useAuthActions();
|
|
117
131
|
const { verifyExternalWalletAsync } = useVerifyExternalWallet();
|
|
118
132
|
const queryClient = useQueryClient();
|
|
133
|
+
const goBack = useGoBack();
|
|
119
134
|
const [qrUri, setQrUri] = useState();
|
|
120
135
|
const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
|
|
121
136
|
const [isSigningMessage, setIsSigningMessage] = useState(false);
|
|
137
|
+
const popupCloseIntervalRef = useRef(null);
|
|
122
138
|
const allWallets = [...evmWallets, ...solanaWallets, ...cosmosWallets];
|
|
123
139
|
let wallets = allWallets.filter(
|
|
124
140
|
(w) => (w.internalId !== "FARCASTER" || (para == null ? void 0 : para.isFarcasterMiniApp)) && externalWallets.includes(w.internalId)
|
|
125
141
|
).sort(
|
|
126
142
|
(a, b) => externalWallets.indexOf(a.internalId) - externalWallets.indexOf(b.internalId)
|
|
127
|
-
)
|
|
143
|
+
);
|
|
128
144
|
const injectedWallets = allWallets.filter(
|
|
129
145
|
(w) => (w == null ? void 0 : w.id) !== "Para" && !wallets.some((wallet2) => wallet2.id === w.id) && w.installed
|
|
130
146
|
);
|
|
131
|
-
wallets = [...wallets, ...injectedWallets];
|
|
147
|
+
wallets = [...wallets, ...injectedWallets].sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
|
|
132
148
|
const wallet = useMemo(
|
|
133
149
|
() => wallets.find((w) => w.id === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.id) && w.type === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.type)),
|
|
134
150
|
[wallets, selectedExternalWallet]
|
|
135
151
|
);
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
const [walletConnectCleanup, setWalletConnectCleanup] = useState(null);
|
|
153
|
+
const listenForWalletConnectUri = () => {
|
|
154
|
+
setQrUri(void 0);
|
|
155
|
+
if (walletConnectCleanup) {
|
|
156
|
+
walletConnectCleanup();
|
|
157
|
+
}
|
|
158
|
+
const callback = (event) => {
|
|
159
|
+
openMobileUrl(event.detail);
|
|
160
|
+
setQrUri(event.detail);
|
|
161
|
+
cleanup();
|
|
162
|
+
setWalletConnectCleanup(null);
|
|
163
|
+
};
|
|
164
|
+
const cleanup = () => {
|
|
165
|
+
window.removeEventListener("PARA_WALLETCONNECT_URI_READY", callback);
|
|
166
|
+
};
|
|
167
|
+
window.addEventListener("PARA_WALLETCONNECT_URI_READY", callback);
|
|
168
|
+
setWalletConnectCleanup(() => cleanup);
|
|
169
|
+
return cleanup;
|
|
170
|
+
};
|
|
171
|
+
const isWithFullAuth = (wallet2) => {
|
|
172
|
+
if (connectionOnly) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
if (externalWalletsWithFullAuth === "ALL") {
|
|
176
|
+
return true;
|
|
148
177
|
}
|
|
149
|
-
|
|
178
|
+
return !!wallet2.name && externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase());
|
|
179
|
+
};
|
|
150
180
|
const getWalletBalance = useCallback(() => __async(this, null, function* () {
|
|
151
181
|
var _a;
|
|
152
182
|
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
@@ -237,14 +267,13 @@ function ExternalWalletProvider({ children }) {
|
|
|
237
267
|
[evmSwitchChain, cosmosSwitchChain]
|
|
238
268
|
);
|
|
239
269
|
const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
|
|
240
|
-
var _a;
|
|
241
270
|
setExternalWalletError();
|
|
242
271
|
const wallet2 = Object.values(para.externalWallets)[0];
|
|
243
272
|
const walletType = wallet2 == null ? void 0 : wallet2.type;
|
|
244
273
|
let verifyExternalWalletParams;
|
|
245
274
|
const withVerification = includeWalletVerification;
|
|
246
275
|
const isConnectionOnly = connectionOnly;
|
|
247
|
-
const withFullParaAuth = (wallet2 == null ? void 0 : wallet2.name) ?
|
|
276
|
+
const withFullParaAuth = (wallet2 == null ? void 0 : wallet2.name) ? isWithFullAuth(wallet2) : false;
|
|
248
277
|
const defaultWalletInfo = {
|
|
249
278
|
withVerification,
|
|
250
279
|
isConnectionOnly,
|
|
@@ -322,7 +351,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
322
351
|
try {
|
|
323
352
|
const d = yield verifyExternalWalletAsync(verifyExternalWalletParams);
|
|
324
353
|
yield queryClient.refetchQueries({ queryKey: [IS_FULLY_LOGGED_IN_BASE_KEY] });
|
|
325
|
-
if (wallet2 && (
|
|
354
|
+
if (wallet2 && isWithFullAuth(wallet2)) {
|
|
326
355
|
yield onNewAuthState(d);
|
|
327
356
|
} else {
|
|
328
357
|
setStep(ModalStep.LOGIN_DONE);
|
|
@@ -334,7 +363,10 @@ function ExternalWalletProvider({ children }) {
|
|
|
334
363
|
return verifyExternalWalletParams;
|
|
335
364
|
}), [cosmosSignVerificationMessage, evmSignVerificationMessage, solanaSignVerificationMessage, wallet]);
|
|
336
365
|
const signMessage = useCallback(
|
|
337
|
-
(_0) => __async(this, [_0], function* ({
|
|
366
|
+
(_0) => __async(this, [_0], function* ({
|
|
367
|
+
message,
|
|
368
|
+
externalWallet: _externalWallet
|
|
369
|
+
}) {
|
|
338
370
|
var _a;
|
|
339
371
|
setExternalWalletError();
|
|
340
372
|
setIsSigningMessage(true);
|
|
@@ -345,14 +377,16 @@ function ExternalWalletProvider({ children }) {
|
|
|
345
377
|
switch (walletType) {
|
|
346
378
|
case "COSMOS":
|
|
347
379
|
{
|
|
348
|
-
const { address, signature, error, cosmosPublicKeyHex, cosmosSigner } = yield cosmosSignMessage(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
380
|
+
const { address, signature, error, cosmosPublicKeyHex, cosmosSigner, addressBech32 } = yield cosmosSignMessage(
|
|
381
|
+
{
|
|
382
|
+
message,
|
|
383
|
+
externalWallet
|
|
384
|
+
}
|
|
385
|
+
);
|
|
352
386
|
if (error) {
|
|
353
387
|
throw new Error(error);
|
|
354
388
|
} else if (signature && address) {
|
|
355
|
-
response = { address, signature, cosmosPublicKeyHex, cosmosSigner };
|
|
389
|
+
response = { address, signature, cosmosPublicKeyHex, cosmosSigner, addressBech32 };
|
|
356
390
|
}
|
|
357
391
|
}
|
|
358
392
|
break;
|
|
@@ -388,8 +422,265 @@ function ExternalWalletProvider({ children }) {
|
|
|
388
422
|
}),
|
|
389
423
|
[cosmosSignMessage, evmSignMessage, solanaSignMessage]
|
|
390
424
|
);
|
|
425
|
+
const addAdditionalExternalWallet = useCallback(
|
|
426
|
+
(wallet2) => __async(this, null, function* () {
|
|
427
|
+
setExternalWalletError();
|
|
428
|
+
try {
|
|
429
|
+
const walletInfo = yield requestInfo(wallet2.id, wallet2.type);
|
|
430
|
+
const walletAddress = wallet2.type === "COSMOS" && walletInfo.addressBech32 ? walletInfo.addressBech32 : walletInfo.address;
|
|
431
|
+
const walletKey = walletInfo.address;
|
|
432
|
+
const newWallet = __spreadProps(__spreadValues({}, walletInfo), {
|
|
433
|
+
id: walletKey,
|
|
434
|
+
// Use EVM-style address as the key/ID
|
|
435
|
+
address: walletAddress,
|
|
436
|
+
// Use bech32 address for Cosmos, regular for others
|
|
437
|
+
name: wallet2.name,
|
|
438
|
+
// Ensure the name is set from the wallet object
|
|
439
|
+
isExternal: true,
|
|
440
|
+
isExternalWithParaAuth: false,
|
|
441
|
+
externalProviderId: walletInfo.provider || wallet2.name,
|
|
442
|
+
signer: "",
|
|
443
|
+
isExternalConnectionOnly: true,
|
|
444
|
+
isExternalWithVerification: includeWalletVerification
|
|
445
|
+
});
|
|
446
|
+
yield para.setExternalWallets((currentWallets) => {
|
|
447
|
+
const updatedWallets = __spreadProps(__spreadValues({}, currentWallets), {
|
|
448
|
+
[walletKey]: newWallet
|
|
449
|
+
});
|
|
450
|
+
return updatedWallets;
|
|
451
|
+
});
|
|
452
|
+
dispatchEvent(ParaEvent.EXTERNAL_WALLET_CHANGE_EVENT, null);
|
|
453
|
+
try {
|
|
454
|
+
const externalWalletInfo = __spreadProps(__spreadValues({
|
|
455
|
+
partnerId: para.partnerId,
|
|
456
|
+
address: walletInfo.address
|
|
457
|
+
}, wallet2.type === "COSMOS" && walletInfo.addressBech32 && {
|
|
458
|
+
addressBech32: walletInfo.addressBech32
|
|
459
|
+
// Include bech32 address for Cosmos
|
|
460
|
+
}), {
|
|
461
|
+
type: wallet2.type,
|
|
462
|
+
provider: walletInfo.provider,
|
|
463
|
+
providerId: walletInfo.providerId
|
|
464
|
+
// Use the providerId from requestInfo
|
|
465
|
+
});
|
|
466
|
+
const linkResult = yield para.linkAccount({ externalWallet: externalWalletInfo });
|
|
467
|
+
if (linkResult && linkResult.externalWallet && "signatureVerificationMessage" in linkResult.externalWallet) {
|
|
468
|
+
const verificationMessage = linkResult.externalWallet.signatureVerificationMessage;
|
|
469
|
+
const signResult = yield signMessage({
|
|
470
|
+
message: verificationMessage,
|
|
471
|
+
externalWallet: externalWalletInfo
|
|
472
|
+
});
|
|
473
|
+
if (!signResult || !signResult.signature) {
|
|
474
|
+
throw new Error(`Failed to sign ${wallet2.type} message: No signature returned`);
|
|
475
|
+
}
|
|
476
|
+
const { signature: signedMessage, cosmosPublicKeyHex, cosmosSigner } = signResult;
|
|
477
|
+
yield para.verifyExternalWalletLink({ signedMessage, cosmosPublicKeyHex, cosmosSigner });
|
|
478
|
+
} else {
|
|
479
|
+
throw new Error("Unknown error linking external wallet");
|
|
480
|
+
}
|
|
481
|
+
} catch (e) {
|
|
482
|
+
}
|
|
483
|
+
yield connectEmbeddedToExternalConnectors();
|
|
484
|
+
setStep(ModalStep.ACCOUNT_PROFILE);
|
|
485
|
+
} catch (e) {
|
|
486
|
+
setExternalWalletError(["Failed to add wallet. Please try again."]);
|
|
487
|
+
}
|
|
488
|
+
}),
|
|
489
|
+
[para, connectionOnly, includeWalletVerification, setStep, setExternalWalletError]
|
|
490
|
+
);
|
|
491
|
+
const setupExternalWalletVerificationStatusListener = (wallet2) => {
|
|
492
|
+
typeof window !== "undefined" && window.addEventListener("message", function handleMessage(event) {
|
|
493
|
+
return __async(this, null, function* () {
|
|
494
|
+
var _a, _b, _c, _d;
|
|
495
|
+
if (!validatePortalOrigin(event, para.ctx)) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "EW_VERIFY_SUCCESS") {
|
|
499
|
+
clearPopupWindowCloseListener();
|
|
500
|
+
const serverAuthState = (_b = event.data) == null ? void 0 : _b.serverAuthState;
|
|
501
|
+
if (serverAuthState && ((_c = serverAuthState.externalWallet) == null ? void 0 : _c.withFullParaAuth)) {
|
|
502
|
+
const authState = yield para.verifyExternalWallet({ serverAuthState });
|
|
503
|
+
yield onNewAuthState(authState);
|
|
504
|
+
} else {
|
|
505
|
+
setStep(ModalStep.LOGIN_DONE);
|
|
506
|
+
}
|
|
507
|
+
window.removeEventListener("message", handleMessage);
|
|
508
|
+
}
|
|
509
|
+
if (((_d = event.data) == null ? void 0 : _d.type) === "EW_VERIFY_RETRY") {
|
|
510
|
+
yield handleTriggerSignMessage(wallet2, event.data.message);
|
|
511
|
+
window.removeEventListener("message", handleMessage);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
};
|
|
516
|
+
const handlePostMessage = (message) => {
|
|
517
|
+
var _a;
|
|
518
|
+
if (refs.popupWindow.current) {
|
|
519
|
+
refs.popupWindow.current.postMessage(message, "*");
|
|
520
|
+
} else if (refs.iFrame.current) {
|
|
521
|
+
(_a = refs.iFrame.current.contentWindow) == null ? void 0 : _a.postMessage(message, "*");
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
const handleTriggerSignMessage = (wallet2, message) => __async(this, null, function* () {
|
|
525
|
+
setupExternalWalletVerificationStatusListener(wallet2);
|
|
526
|
+
try {
|
|
527
|
+
const { address, signature, cosmosPublicKeyHex, cosmosSigner, addressBech32 } = yield signMessage({
|
|
528
|
+
message,
|
|
529
|
+
externalWallet: wallet2
|
|
530
|
+
});
|
|
531
|
+
const paraWallet = Object.values(para.externalWallets)[0];
|
|
532
|
+
const walletType = paraWallet == null ? void 0 : paraWallet.type;
|
|
533
|
+
let verifyExternalWalletParams;
|
|
534
|
+
const withVerification = includeWalletVerification;
|
|
535
|
+
const isConnectionOnly = connectionOnly;
|
|
536
|
+
const withFullParaAuth = (paraWallet == null ? void 0 : paraWallet.name) ? isWithFullAuth(paraWallet) : false;
|
|
537
|
+
const defaultWalletInfo = {
|
|
538
|
+
withVerification,
|
|
539
|
+
isConnectionOnly,
|
|
540
|
+
withFullParaAuth,
|
|
541
|
+
provider: paraWallet.name,
|
|
542
|
+
providerId: paraWallet.externalProviderId,
|
|
543
|
+
isExternal: true
|
|
544
|
+
};
|
|
545
|
+
switch (walletType) {
|
|
546
|
+
case "COSMOS":
|
|
547
|
+
{
|
|
548
|
+
verifyExternalWalletParams = {
|
|
549
|
+
externalWallet: __spreadValues({
|
|
550
|
+
partnerId: para.partnerId,
|
|
551
|
+
type: "COSMOS",
|
|
552
|
+
address,
|
|
553
|
+
addressBech32
|
|
554
|
+
}, defaultWalletInfo),
|
|
555
|
+
signedMessage: signature,
|
|
556
|
+
cosmosPublicKeyHex,
|
|
557
|
+
cosmosSigner
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
break;
|
|
561
|
+
case "EVM":
|
|
562
|
+
{
|
|
563
|
+
verifyExternalWalletParams = {
|
|
564
|
+
externalWallet: __spreadValues({
|
|
565
|
+
partnerId: para.partnerId,
|
|
566
|
+
type: "EVM",
|
|
567
|
+
address
|
|
568
|
+
}, defaultWalletInfo),
|
|
569
|
+
signedMessage: signature
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
break;
|
|
573
|
+
case "SOLANA":
|
|
574
|
+
{
|
|
575
|
+
verifyExternalWalletParams = {
|
|
576
|
+
externalWallet: __spreadValues({
|
|
577
|
+
partnerId: para.partnerId,
|
|
578
|
+
type: "SOLANA",
|
|
579
|
+
address
|
|
580
|
+
}, defaultWalletInfo),
|
|
581
|
+
signedMessage: signature
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
break;
|
|
585
|
+
default:
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
if (!(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.externalWallet) || !(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.signedMessage)) {
|
|
589
|
+
console.error("No signature or address found on the verifyWalletSignature response.");
|
|
590
|
+
handlePostMessage({ type: "EW_SIGN_MESSAGE_ERROR", error: "Signature verification failed." });
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
handlePostMessage({ type: "EW_SIGN_MESSAGE_SUCCESS", verifyExternalWalletParams });
|
|
594
|
+
} catch (error) {
|
|
595
|
+
handlePostMessage({ type: "EW_SIGN_MESSAGE_ERROR", error: error.message || "Error signing message" });
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
const setupExternalWalletVerificationTriggerListener = (wallet2) => {
|
|
599
|
+
if (!wallet2) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
typeof window !== "undefined" && window.addEventListener("message", function handleMessage(event) {
|
|
603
|
+
return __async(this, null, function* () {
|
|
604
|
+
var _a;
|
|
605
|
+
if (!validatePortalOrigin(event, para.ctx)) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "EW_TRIGGER_SIGN_MESSAGE") {
|
|
609
|
+
yield handleTriggerSignMessage(wallet2, event.data.message);
|
|
610
|
+
window.removeEventListener("message", handleMessage);
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
};
|
|
615
|
+
const setupPopupWindowCloseListener = () => {
|
|
616
|
+
const popup = refs.popupWindow.current;
|
|
617
|
+
if (!popup) return;
|
|
618
|
+
if (popupCloseIntervalRef.current) {
|
|
619
|
+
clearInterval(popupCloseIntervalRef.current);
|
|
620
|
+
}
|
|
621
|
+
popupCloseIntervalRef.current = setInterval(() => {
|
|
622
|
+
if (popup.closed) {
|
|
623
|
+
if (popupCloseIntervalRef.current) {
|
|
624
|
+
clearInterval(popupCloseIntervalRef.current);
|
|
625
|
+
popupCloseIntervalRef.current = null;
|
|
626
|
+
}
|
|
627
|
+
goBack();
|
|
628
|
+
disconnectExternalWallet();
|
|
629
|
+
}
|
|
630
|
+
}, 500);
|
|
631
|
+
};
|
|
632
|
+
const clearPopupWindowCloseListener = () => {
|
|
633
|
+
if (popupCloseIntervalRef.current) {
|
|
634
|
+
clearInterval(popupCloseIntervalRef.current);
|
|
635
|
+
popupCloseIntervalRef.current = null;
|
|
636
|
+
refs.popupWindow.current = null;
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
const handlePostConnectRetry = () => {
|
|
640
|
+
handlePostMessage({ type: "EW_CONNECT_RETRY" });
|
|
641
|
+
};
|
|
642
|
+
const handlePostConnectError = (error) => {
|
|
643
|
+
handlePostMessage({ type: "EW_CONNECT_ERROR", error });
|
|
644
|
+
};
|
|
645
|
+
const handleConnectRetryMessage = (wallet2) => (event) => __async(this, null, function* () {
|
|
646
|
+
var _a;
|
|
647
|
+
if (!validatePortalOrigin(event, para.ctx)) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "EW_CONNECT_RETRY") {
|
|
651
|
+
clearExternalWalletConnectionRetryListener(wallet2);
|
|
652
|
+
yield connectExternalWallet({ wallet: wallet2, isMobileConnect: wallet2.isMobile, isRetryConnection: true });
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
const setupExternalWalletConnectionRetryListener = (wallet2) => {
|
|
656
|
+
typeof window !== "undefined" && window.addEventListener("message", handleConnectRetryMessage(wallet2));
|
|
657
|
+
};
|
|
658
|
+
const clearExternalWalletConnectionRetryListener = (wallet2) => {
|
|
659
|
+
window.removeEventListener("message", handleConnectRetryMessage(wallet2));
|
|
660
|
+
};
|
|
391
661
|
const connectExternalWallet = useCallback(
|
|
392
|
-
(
|
|
662
|
+
(_0) => __async(this, [_0], function* ({
|
|
663
|
+
wallet: wallet2,
|
|
664
|
+
isManualWalletConnect,
|
|
665
|
+
isMobileConnect,
|
|
666
|
+
isResetAfterManualWalletConnect,
|
|
667
|
+
isRetryConnection
|
|
668
|
+
}) {
|
|
669
|
+
if (isRetryConnection) {
|
|
670
|
+
clearExternalWalletConnectionRetryListener(wallet2);
|
|
671
|
+
handlePostConnectRetry();
|
|
672
|
+
}
|
|
673
|
+
if (!isMobile() && isWithFullAuth(wallet2)) {
|
|
674
|
+
const popupUrl = yield para.constructPortalUrl("connectExternalWallet");
|
|
675
|
+
if (typeof window !== void 0) {
|
|
676
|
+
refs.popupWindow.current = openPopup({
|
|
677
|
+
url: popupUrl,
|
|
678
|
+
type: "LOGIN_EXTERNAL_WALLET",
|
|
679
|
+
target: "ParaExternalWallet"
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
setupPopupWindowCloseListener();
|
|
683
|
+
}
|
|
393
684
|
if (isExternalWalletConnecting && isManualWalletConnect) {
|
|
394
685
|
yield evmDisconnect();
|
|
395
686
|
yield solanaDisconnect();
|
|
@@ -397,23 +688,27 @@ function ExternalWalletProvider({ children }) {
|
|
|
397
688
|
setQrUri(void 0);
|
|
398
689
|
setIsExternalWalletConnecting(false);
|
|
399
690
|
}
|
|
400
|
-
if (isResetAfterManualWalletConnect || isManualWalletConnect || !isExternalWalletConnecting) {
|
|
691
|
+
if (isResetAfterManualWalletConnect || isManualWalletConnect || isMobileConnect || !isExternalWalletConnecting) {
|
|
401
692
|
setExternalWalletError();
|
|
402
693
|
setIsExternalWalletConnecting(true);
|
|
403
694
|
setIsUsingMobileConnector(isMobileConnect);
|
|
695
|
+
listenForWalletConnectUri();
|
|
404
696
|
const { address, error, authState } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect, connectionOnly) : wallet2.connect(connectionOnly);
|
|
405
697
|
if (error) {
|
|
406
698
|
setExternalWalletError([error]);
|
|
407
699
|
setIsUsingMobileConnector();
|
|
700
|
+
handlePostConnectError(error);
|
|
408
701
|
if (isManualWalletConnect && error === "Connection request rejected") {
|
|
409
702
|
setExternalWalletError();
|
|
410
|
-
yield connectExternalWallet(wallet2,
|
|
411
|
-
yield updateQrUri();
|
|
703
|
+
yield connectExternalWallet({ wallet: wallet2, isResetAfterManualWalletConnect: true });
|
|
412
704
|
return;
|
|
413
705
|
}
|
|
706
|
+
setupExternalWalletConnectionRetryListener(wallet2);
|
|
414
707
|
} else if (address) {
|
|
415
|
-
if (!!authState && ((
|
|
708
|
+
if (!!authState && (isWithFullAuth(wallet2) || includeWalletVerification)) {
|
|
709
|
+
clearExternalWalletConnectionRetryListener(wallet2);
|
|
416
710
|
onNewAuthState(authState);
|
|
711
|
+
setupExternalWalletVerificationTriggerListener(authState.externalWallet);
|
|
417
712
|
} else {
|
|
418
713
|
setStep(ModalStep.LOGIN_DONE);
|
|
419
714
|
}
|
|
@@ -439,7 +734,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
439
734
|
isConnectionOnly: true
|
|
440
735
|
});
|
|
441
736
|
} else {
|
|
442
|
-
yield connectExternalWallet(evmWallet,
|
|
737
|
+
yield connectExternalWallet({ wallet: evmWallet, isManualWalletConnect: true });
|
|
443
738
|
}
|
|
444
739
|
}
|
|
445
740
|
if (solanaWallet && (solanaFarcasterStatus == null ? void 0 : solanaFarcasterStatus.isPresent)) {
|
|
@@ -453,7 +748,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
453
748
|
isConnectionOnly: true
|
|
454
749
|
});
|
|
455
750
|
} else {
|
|
456
|
-
yield connectExternalWallet(solanaWallet,
|
|
751
|
+
yield connectExternalWallet({ wallet: solanaWallet, isManualWalletConnect: true });
|
|
457
752
|
}
|
|
458
753
|
}
|
|
459
754
|
if (loginWallets.length > 0) {
|
|
@@ -465,6 +760,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
465
760
|
}
|
|
466
761
|
});
|
|
467
762
|
const requestInfo = (providerId, type) => __async(this, null, function* () {
|
|
763
|
+
listenForWalletConnectUri();
|
|
468
764
|
switch (type) {
|
|
469
765
|
case "EVM": {
|
|
470
766
|
const externalWallet = yield evmRequestInfo(providerId);
|
|
@@ -478,21 +774,36 @@ function ExternalWalletProvider({ children }) {
|
|
|
478
774
|
const externalWallet = yield cosmosRequestInfo(providerId);
|
|
479
775
|
return externalWallet;
|
|
480
776
|
}
|
|
777
|
+
default: {
|
|
778
|
+
throw new Error(`Unsupported wallet type: ${type}`);
|
|
779
|
+
}
|
|
481
780
|
}
|
|
482
781
|
});
|
|
483
|
-
const disconnectBase = (providerId, type) => __async(this, null, function* () {
|
|
782
|
+
const disconnectBase = (providerId, type, opts) => __async(this, null, function* () {
|
|
484
783
|
switch (type) {
|
|
485
784
|
case "EVM":
|
|
486
|
-
yield evmDisconnectBase(providerId);
|
|
785
|
+
yield evmDisconnectBase(providerId, opts);
|
|
487
786
|
break;
|
|
488
787
|
case "SOLANA":
|
|
489
|
-
yield solanaDisconnectBase(providerId);
|
|
788
|
+
yield solanaDisconnectBase(providerId, opts);
|
|
490
789
|
break;
|
|
491
790
|
default: {
|
|
492
|
-
yield cosmosDisconnectBase();
|
|
791
|
+
yield cosmosDisconnectBase(void 0, opts);
|
|
493
792
|
break;
|
|
494
793
|
}
|
|
495
794
|
}
|
|
795
|
+
if ((opts == null ? void 0 : opts.disconnectType) === "ACCOUNT_WIDGET") {
|
|
796
|
+
yield para.setExternalWallets(
|
|
797
|
+
(prev) => Object.entries(prev).reduce((acc, [address, externalWallet]) => {
|
|
798
|
+
if (externalWallet.type === type && externalWallet.externalProviderId === providerId) {
|
|
799
|
+
return acc;
|
|
800
|
+
}
|
|
801
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
802
|
+
[address]: externalWallet
|
|
803
|
+
});
|
|
804
|
+
}, {})
|
|
805
|
+
);
|
|
806
|
+
}
|
|
496
807
|
});
|
|
497
808
|
const disconnectExternalWallet = () => __async(this, null, function* () {
|
|
498
809
|
if (para.isExternalWalletAuth) yield para.logout();
|
|
@@ -592,6 +903,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
592
903
|
username,
|
|
593
904
|
avatar,
|
|
594
905
|
connectExternalWallet,
|
|
906
|
+
addAdditionalExternalWallet,
|
|
595
907
|
disconnectExternalWallet,
|
|
596
908
|
switchChain,
|
|
597
909
|
setChainIdSwitchingTo,
|
|
@@ -603,7 +915,10 @@ function ExternalWalletProvider({ children }) {
|
|
|
603
915
|
requestInfo,
|
|
604
916
|
disconnectBase,
|
|
605
917
|
connectFarcasterMiniApp,
|
|
606
|
-
verificationStage
|
|
918
|
+
verificationStage,
|
|
919
|
+
evmDisconnectStatus,
|
|
920
|
+
solanaDisconnectStatus,
|
|
921
|
+
cosmosDisconnectStatus
|
|
607
922
|
}),
|
|
608
923
|
[
|
|
609
924
|
wallets,
|
|
@@ -617,6 +932,7 @@ function ExternalWalletProvider({ children }) {
|
|
|
617
932
|
avatar,
|
|
618
933
|
disconnectExternalWallet,
|
|
619
934
|
connectExternalWallet,
|
|
935
|
+
addAdditionalExternalWallet,
|
|
620
936
|
switchChain,
|
|
621
937
|
setChainIdSwitchingTo,
|
|
622
938
|
connectEmbeddedToExternalConnectors,
|
|
@@ -627,7 +943,10 @@ function ExternalWalletProvider({ children }) {
|
|
|
627
943
|
requestInfo,
|
|
628
944
|
disconnectBase,
|
|
629
945
|
connectFarcasterMiniApp,
|
|
630
|
-
verificationStage
|
|
946
|
+
verificationStage,
|
|
947
|
+
evmDisconnectStatus,
|
|
948
|
+
solanaDisconnectStatus,
|
|
949
|
+
cosmosDisconnectStatus
|
|
631
950
|
]
|
|
632
951
|
),
|
|
633
952
|
children
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getClient: () => import("
|
|
1
|
+
export declare const getClient: () => import("graz").ParaWeb | undefined;
|
|
2
2
|
export declare const getIsOpen: () => boolean;
|
|
3
3
|
export declare const getSelectedWalletId: () => string | undefined;
|
|
4
|
-
export declare const getSelectedWalletType: () => "
|
|
4
|
+
export declare const getSelectedWalletType: () => "SOLANA" | "COSMOS" | "EVM" | undefined;
|
|
@@ -15,7 +15,10 @@ const createModalSlice = (set) => ({
|
|
|
15
15
|
oAuthLogoVariant: "default",
|
|
16
16
|
isOpen: false,
|
|
17
17
|
setIsOpen: (isOpen) => set({ isOpen }),
|
|
18
|
-
|
|
18
|
+
refs: {
|
|
19
|
+
openedToStep: createRef(),
|
|
20
|
+
balancesInvalidationTime: createRef()
|
|
21
|
+
}
|
|
19
22
|
});
|
|
20
23
|
export {
|
|
21
24
|
createModalSlice
|
|
@@ -36,7 +36,10 @@ export interface ModalSlice {
|
|
|
36
36
|
oAuthLogoVariant: OAuthLogoVariantType;
|
|
37
37
|
isOpen: boolean;
|
|
38
38
|
setIsOpen: (_: boolean) => void;
|
|
39
|
-
|
|
39
|
+
refs: {
|
|
40
|
+
openedToStep: MutableRefObject<ModalStep | null>;
|
|
41
|
+
balancesInvalidationTime: MutableRefObject<number | null>;
|
|
42
|
+
};
|
|
40
43
|
}
|
|
41
44
|
export interface WalletSlice {
|
|
42
45
|
rpcUrl?: string;
|
|
@@ -53,8 +56,8 @@ export interface ExternalWalletsSlice {
|
|
|
53
56
|
setConnectionOnly: (_: boolean) => void;
|
|
54
57
|
includeWalletVerification: boolean;
|
|
55
58
|
setIncludeWalletVerification: (_: boolean) => void;
|
|
56
|
-
externalWalletsWithFullAuth: TExternalWallet[];
|
|
57
|
-
setExternalWalletsWithFullAuth: (_: TExternalWallet[]) => void;
|
|
59
|
+
externalWalletsWithFullAuth: TExternalWallet[] | 'ALL';
|
|
60
|
+
setExternalWalletsWithFullAuth: (_: TExternalWallet[] | 'ALL') => void;
|
|
58
61
|
evmLib: typeof paraEvmLib | undefined;
|
|
59
62
|
setEvmLib: (_: typeof paraEvmLib) => void;
|
|
60
63
|
evmContext: Context<EvmExternalWalletContextType>;
|