@openfort/react 1.0.11 → 1.0.13
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.
|
@@ -5,6 +5,7 @@ import { routes } from '../components/Openfort/types.js';
|
|
|
5
5
|
import { useOpenfort } from '../components/Openfort/useOpenfort.js';
|
|
6
6
|
import { embeddedWalletId } from '../constants/openfort.js';
|
|
7
7
|
import { ConnectionStrategyProvider, useConnectionStrategy } from '../core/ConnectionStrategyContext.js';
|
|
8
|
+
import { resolveEthereumFeeSponsorship } from '../core/strategyUtils.js';
|
|
8
9
|
import { OpenfortEthereumBridgeContext } from '../ethereum/OpenfortEthereumBridgeContext.js';
|
|
9
10
|
import { useConnectLifecycle } from '../hooks/useConnectLifecycle.js';
|
|
10
11
|
import { showInitBanner } from '../utils/banner.js';
|
|
@@ -230,6 +231,7 @@ const CoreOpenfortProvider = ({ children, onConnect, onDisconnect, openfortConfi
|
|
|
230
231
|
const initInProgressRef = useRef(false);
|
|
231
232
|
// Init provider; only fetch accounts when READY (prevents list() before auth is stored)
|
|
232
233
|
useEffect(() => {
|
|
234
|
+
var _a;
|
|
233
235
|
if (!openfort || !walletConfig || !strategy)
|
|
234
236
|
return;
|
|
235
237
|
// EVM: only run at READY — auto-recover handles EMBEDDED_SIGNER_NOT_CONFIGURED → READY.
|
|
@@ -242,12 +244,14 @@ const CoreOpenfortProvider = ({ children, onConnect, onDisconnect, openfortConfi
|
|
|
242
244
|
}
|
|
243
245
|
}
|
|
244
246
|
// Skip if we already initialized with the same parameters
|
|
245
|
-
const
|
|
247
|
+
const feeSponsorshipPolicy = evmChainId != null ? (_a = resolveEthereumFeeSponsorship(walletConfig, evmChainId)) === null || _a === void 0 ? void 0 : _a.policy : undefined;
|
|
248
|
+
const initKey = { kind: strategy.kind, chainType: strategy.chainType, evmChainId, feeSponsorshipPolicy };
|
|
246
249
|
const prev = lastInitRef.current;
|
|
247
250
|
if (prev &&
|
|
248
251
|
prev.kind === initKey.kind &&
|
|
249
252
|
prev.chainType === initKey.chainType &&
|
|
250
|
-
prev.evmChainId === initKey.evmChainId
|
|
253
|
+
prev.evmChainId === initKey.evmChainId &&
|
|
254
|
+
prev.feeSponsorshipPolicy === initKey.feeSponsorshipPolicy) {
|
|
251
255
|
return;
|
|
252
256
|
}
|
|
253
257
|
// Prevent concurrent initProvider calls
|
|
@@ -273,9 +277,11 @@ const CoreOpenfortProvider = ({ children, onConnect, onDisconnect, openfortConfi
|
|
|
273
277
|
initInProgressRef.current = false;
|
|
274
278
|
});
|
|
275
279
|
return () => {
|
|
280
|
+
// Don't reset lastInitRef/initInProgressRef here. Bridge churn during wagmi
|
|
281
|
+
// hydration (walletClient/ENS resolving) recreates the strategy and re-runs
|
|
282
|
+
// this effect with the same initKey; resetting would defeat the dedup and
|
|
283
|
+
// re-fire initProvider → repeated /v2/accounts/switch-chain 422s.
|
|
276
284
|
cancelled = true;
|
|
277
|
-
lastInitRef.current = null;
|
|
278
|
-
initInProgressRef.current = false;
|
|
279
285
|
};
|
|
280
286
|
}, [openfort, walletConfig, strategy, evmChainId, storeEmbeddedState]);
|
|
281
287
|
// On refresh, embeddedState reaches READY before the user is loaded, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreOpenfortProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoreOpenfortProvider.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.13";
|
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.13",
|
|
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.",
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"README.md"
|
|
51
51
|
],
|
|
52
52
|
"sideEffects": false,
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public",
|
|
55
|
+
"provenance": true
|
|
56
|
+
},
|
|
53
57
|
"keywords": [
|
|
54
58
|
"react-hook",
|
|
55
59
|
"blockchain",
|