@openfort/react 1.0.13 → 1.0.15
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/core/strategies/EthereumBridgeStrategy.js +17 -16
- package/build/core/strategies/EthereumBridgeStrategy.js.map +1 -1
- package/build/core/strategies/EthereumEmbeddedStrategy.js +17 -16
- package/build/core/strategies/EthereumEmbeddedStrategy.js.map +1 -1
- package/build/openfort/CoreOpenfortProvider.js +1 -1
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/package.json +2 -2
|
@@ -53,22 +53,23 @@ function createEthereumBridgeStrategy(bridge, connectors) {
|
|
|
53
53
|
},
|
|
54
54
|
});
|
|
55
55
|
// Tell the provider which chain is active (EIP-1193). Keeps provider in sync with wagmi.
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
// Real iframe-state check: throws when Account.fromStorage is empty (signer not yet
|
|
57
|
+
// configured by configure/create/recover). Avoids spurious /v2/accounts/switch-chain
|
|
58
|
+
// calls (422 with account=null) and redundant calls when already on target chain.
|
|
59
|
+
if (chainId == null || chainId === lastInitChainId)
|
|
60
|
+
return;
|
|
61
|
+
const wallet = await openfort.embeddedWallet.get().catch(() => null);
|
|
62
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address) || wallet.chainId === chainId)
|
|
63
|
+
return;
|
|
64
|
+
try {
|
|
65
|
+
await provider.request({
|
|
66
|
+
method: 'wallet_switchEthereumChain',
|
|
67
|
+
params: [{ chainId: `0x${chainId.toString(16)}` }],
|
|
68
|
+
});
|
|
69
|
+
lastInitChainId = chainId;
|
|
70
|
+
}
|
|
71
|
+
catch (switchErr) {
|
|
72
|
+
logger.warn('[@openfort/react] wallet_switchEthereumChain failed — provider may be on wrong chain', switchErr);
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
async disconnect(openfort) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumBridgeStrategy.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumBridgeStrategy.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -56,22 +56,23 @@ function createEthereumEmbeddedStrategy(walletConfig) {
|
|
|
56
56
|
});
|
|
57
57
|
// Tell the provider which chain is active (EIP-1193). Without this, the provider
|
|
58
58
|
// stays on its initial chain (e.g. 80002) while fee sponsorship resolution is per-chain.
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
// Real iframe-state check: throws when Account.fromStorage is empty (signer not yet
|
|
60
|
+
// configured by configure/create/recover). Avoids spurious /v2/accounts/switch-chain
|
|
61
|
+
// calls (422 with account=null) and redundant calls when already on target chain.
|
|
62
|
+
if (chainId === lastInitChainId)
|
|
63
|
+
return;
|
|
64
|
+
const wallet = await openfort.embeddedWallet.get().catch(() => null);
|
|
65
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address) || wallet.chainId === chainId)
|
|
66
|
+
return;
|
|
67
|
+
try {
|
|
68
|
+
await provider.request({
|
|
69
|
+
method: 'wallet_switchEthereumChain',
|
|
70
|
+
params: [{ chainId: `0x${chainId.toString(16)}` }],
|
|
71
|
+
});
|
|
72
|
+
lastInitChainId = chainId;
|
|
73
|
+
}
|
|
74
|
+
catch (switchErr) {
|
|
75
|
+
logger.warn('[@openfort/react] wallet_switchEthereumChain failed — provider may be on wrong chain', switchErr);
|
|
75
76
|
}
|
|
76
77
|
},
|
|
77
78
|
async disconnect(openfort) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumEmbeddedStrategy.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumEmbeddedStrategy.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -283,7 +283,7 @@ const CoreOpenfortProvider = ({ children, onConnect, onDisconnect, openfortConfi
|
|
|
283
283
|
// re-fire initProvider → repeated /v2/accounts/switch-chain 422s.
|
|
284
284
|
cancelled = true;
|
|
285
285
|
};
|
|
286
|
-
}, [openfort, walletConfig, strategy, evmChainId, storeEmbeddedState]);
|
|
286
|
+
}, [openfort, walletConfig, strategy, evmChainId, storeEmbeddedState, storeActiveEmbeddedAddress]);
|
|
287
287
|
// On refresh, embeddedState reaches READY before the user is loaded, so
|
|
288
288
|
// fetchEmbeddedAccounts (called inside initProvider) returns empty. Re-fetch
|
|
289
289
|
// once the user becomes available while still in READY state.
|
package/build/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OPENFORT_VERSION = "1.0.
|
|
1
|
+
export declare const OPENFORT_VERSION = "1.0.15";
|
package/build/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfort/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
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.",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"react"
|
|
66
66
|
],
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@openfort/openfort-js": "
|
|
68
|
+
"@openfort/openfort-js": "1.3.3",
|
|
69
69
|
"buffer": "^6.0.3",
|
|
70
70
|
"detect-browser": "^5.3.0",
|
|
71
71
|
"fast-password-entropy": "^1.1.1",
|