@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.
@@ -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
- const isConnected = wallet.status === 'connected';
44
- const address = isConnected ? wallet.address : undefined;
45
- const chainId = isConnected ? wallet.chainId : undefined;
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
- const isConnected = wallet.status === 'connected';
21
- const address = isConnected ? wallet.address : undefined;
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 (embeddedState === EmbeddedState.NONE || embeddedState === EmbeddedState.UNAUTHENTICATED)
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
- const isConnected = wallet.status === 'connected';
32
- const address = isConnected ? wallet.address : undefined;
33
- const chainId = isConnected && chainType === ChainTypeEnum.EVM ? wallet.chainId : undefined;
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- export declare const OPENFORT_VERSION = "1.0.9";
1
+ export declare const OPENFORT_VERSION = "1.0.10";
package/build/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const OPENFORT_VERSION = '1.0.9';
1
+ const OPENFORT_VERSION = '1.0.10';
2
2
 
3
3
  export { OPENFORT_VERSION };
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/react",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "author": "Openfort (https://www.openfort.io)",
5
5
  "license": "BSD-2-Clause license",
6
6
  "description": "The easiest way to integrate Openfort to your project.",