@openfort/react 1.0.9 → 1.0.10
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/build/components/Pages/Connected/EthereumConnected.js +10 -3
- package/build/components/Pages/Connected/EthereumConnected.js.map +1 -1
- package/build/components/Pages/Loading/index.js +8 -3
- package/build/components/Pages/Loading/index.js.map +1 -1
- package/build/components/Pages/Receive/index.js +12 -3
- package/build/components/Pages/Receive/index.js.map +1 -1
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/package.json +1 -1
|
@@ -40,9 +40,16 @@ const EthereumConnected = () => {
|
|
|
40
40
|
const wallet = useEthereumEmbeddedWallet();
|
|
41
41
|
const { embeddedAccounts } = useOpenfortCore();
|
|
42
42
|
const hasEthereumWallets = ((_a = embeddedAccounts === null || embeddedAccounts === void 0 ? void 0 : embeddedAccounts.filter((a) => a.chainType === ChainTypeEnum.EVM)) !== null && _a !== void 0 ? _a : []).length > 0;
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
const
|
|
43
|
+
// Use embedded wallet if available, otherwise fall back to bridge (external wallet)
|
|
44
|
+
const embeddedConnected = wallet.status === 'connected';
|
|
45
|
+
const bridgeConnected = !!((bridge === null || bridge === void 0 ? void 0 : bridge.account.isConnected) && (bridge === null || bridge === void 0 ? void 0 : bridge.account.address));
|
|
46
|
+
const isConnected = embeddedConnected || bridgeConnected;
|
|
47
|
+
const address = embeddedConnected
|
|
48
|
+
? wallet.address
|
|
49
|
+
: bridgeConnected
|
|
50
|
+
? bridge.account.address
|
|
51
|
+
: undefined;
|
|
52
|
+
const chainId = embeddedConnected ? wallet.chainId : bridgeConnected ? bridge.chainId : undefined;
|
|
46
53
|
const { chainType } = useOpenfortCore();
|
|
47
54
|
useEffect(() => {
|
|
48
55
|
if (process.env.NODE_ENV === 'development' && chainType !== ChainTypeEnum.EVM) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,6 +2,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { ChainTypeEnum, EmbeddedState } from '@openfort/openfort-js';
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
5
|
+
import { useEthereumBridge } from '../../../ethereum/OpenfortEthereumBridgeContext.js';
|
|
5
6
|
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
6
7
|
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
7
8
|
import Loader from '../../Common/Loading/index.js';
|
|
@@ -13,12 +14,15 @@ const Loading = () => {
|
|
|
13
14
|
const { setRoute, walletConfig } = useOpenfort();
|
|
14
15
|
const { user, isLoadingAccounts, isLoading, needsRecovery, embeddedState } = useOpenfortCore();
|
|
15
16
|
const { chainType } = useOpenfortCore();
|
|
17
|
+
const bridge = useEthereumBridge();
|
|
16
18
|
// Use chain-specific hooks
|
|
17
19
|
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
18
20
|
const solanaWallet = useSolanaEmbeddedWallet();
|
|
19
21
|
const wallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
+
// Check embedded wallet or bridge (external wallet) connection
|
|
23
|
+
const embeddedConnected = wallet.status === 'connected';
|
|
24
|
+
const bridgeConnected = chainType === ChainTypeEnum.EVM && !!((bridge === null || bridge === void 0 ? void 0 : bridge.account.isConnected) && (bridge === null || bridge === void 0 ? void 0 : bridge.account.address));
|
|
25
|
+
const address = embeddedConnected ? wallet.address : bridgeConnected ? bridge === null || bridge === void 0 ? void 0 : bridge.account.address : undefined;
|
|
22
26
|
const [isFirstFrame, setIsFirstFrame] = React.useState(true);
|
|
23
27
|
const [retryCount, setRetryCount] = React.useState(0);
|
|
24
28
|
useEffect(() => {
|
|
@@ -27,7 +31,8 @@ const Loading = () => {
|
|
|
27
31
|
// Wait for the SDK to settle. After storeCredentials the embedded state
|
|
28
32
|
// briefly stays UNAUTHENTICATED/NONE while the SDK processes the token.
|
|
29
33
|
// Routing to PROVIDERS here would abort the auth flow.
|
|
30
|
-
if (
|
|
34
|
+
// However, if bridge (external wallet) is already connected, don't block routing.
|
|
35
|
+
if ((embeddedState === EmbeddedState.NONE || embeddedState === EmbeddedState.UNAUTHENTICATED) && !bridgeConnected)
|
|
31
36
|
return;
|
|
32
37
|
// Also wait while accounts or user are still loading.
|
|
33
38
|
if (isLoadingAccounts || isLoading)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,6 +3,7 @@ import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import Logos from '../../../assets/logos.js';
|
|
5
5
|
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
6
|
+
import { useEthereumBridge } from '../../../ethereum/OpenfortEthereumBridgeContext.js';
|
|
6
7
|
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
7
8
|
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
8
9
|
import { CopyIconButton } from '../../Common/CopyToClipboard/CopyIconButton.js';
|
|
@@ -27,10 +28,18 @@ const Receive = () => {
|
|
|
27
28
|
const { chainType } = useOpenfortCore();
|
|
28
29
|
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
29
30
|
const solanaWallet = useSolanaEmbeddedWallet();
|
|
31
|
+
const bridge = useEthereumBridge();
|
|
30
32
|
const wallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
33
|
+
// Use embedded wallet if available, otherwise fall back to bridge (external wallet)
|
|
34
|
+
const embeddedConnected = wallet.status === 'connected';
|
|
35
|
+
const bridgeConnected = chainType === ChainTypeEnum.EVM && !!((bridge === null || bridge === void 0 ? void 0 : bridge.account.isConnected) && (bridge === null || bridge === void 0 ? void 0 : bridge.account.address));
|
|
36
|
+
const isConnected = embeddedConnected || bridgeConnected;
|
|
37
|
+
const address = embeddedConnected ? wallet.address : bridgeConnected ? bridge === null || bridge === void 0 ? void 0 : bridge.account.address : undefined;
|
|
38
|
+
const chainId = embeddedConnected && chainType === ChainTypeEnum.EVM
|
|
39
|
+
? wallet.chainId
|
|
40
|
+
: bridgeConnected
|
|
41
|
+
? bridge === null || bridge === void 0 ? void 0 : bridge.chainId
|
|
42
|
+
: undefined;
|
|
34
43
|
const chain = chains.find((c) => c.id === chainId);
|
|
35
44
|
const qrValue = address || '';
|
|
36
45
|
const networkLabel = isConnected && chainType === ChainTypeEnum.SVM && solanaWallet.cluster
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OPENFORT_VERSION = "1.0.
|
|
1
|
+
export declare const OPENFORT_VERSION = "1.0.10";
|
package/build/version.js
CHANGED