@openzeppelin/ui-builder-adapter-evm 0.15.0 → 0.15.1
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/index.cjs +37 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/wallet/implementation/wagmi-implementation.ts +48 -2
package/dist/index.cjs
CHANGED
|
@@ -2514,6 +2514,7 @@ var WagmiWalletImplementation = class {
|
|
|
2514
2514
|
__publicField(this, "unsubscribe");
|
|
2515
2515
|
__publicField(this, "initialized", false);
|
|
2516
2516
|
__publicField(this, "walletConnectProjectId");
|
|
2517
|
+
__publicField(this, "rpcConfigUnsubscribe");
|
|
2517
2518
|
this.walletConnectProjectId = walletConnectProjectIdFromAppConfig;
|
|
2518
2519
|
import_ui_builder_utils15.logger.info(
|
|
2519
2520
|
LOG_SYSTEM,
|
|
@@ -2525,6 +2526,39 @@ var WagmiWalletImplementation = class {
|
|
|
2525
2526
|
LOG_SYSTEM,
|
|
2526
2527
|
"WagmiWalletImplementation instance initialized (Wagmi config creation deferred)."
|
|
2527
2528
|
);
|
|
2529
|
+
this.setupRpcConfigListener();
|
|
2530
|
+
}
|
|
2531
|
+
/**
|
|
2532
|
+
* Sets up a listener for RPC configuration changes to invalidate the cached Wagmi config
|
|
2533
|
+
* when user changes RPC settings.
|
|
2534
|
+
*/
|
|
2535
|
+
setupRpcConfigListener() {
|
|
2536
|
+
import("@openzeppelin/ui-builder-utils").then(({ userRpcConfigService }) => {
|
|
2537
|
+
this.rpcConfigUnsubscribe = userRpcConfigService.subscribe("*", (event) => {
|
|
2538
|
+
if (event.type === "rpc-config-changed" || event.type === "rpc-config-cleared") {
|
|
2539
|
+
import_ui_builder_utils15.logger.info(
|
|
2540
|
+
LOG_SYSTEM,
|
|
2541
|
+
`RPC config changed for network ${event.networkId}. Invalidating cached Wagmi config.`
|
|
2542
|
+
);
|
|
2543
|
+
this.defaultInstanceConfig = null;
|
|
2544
|
+
}
|
|
2545
|
+
});
|
|
2546
|
+
}).catch((error) => {
|
|
2547
|
+
import_ui_builder_utils15.logger.error(LOG_SYSTEM, "Failed to setup RPC config listener:", error);
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
/**
|
|
2551
|
+
* Cleanup method to unsubscribe from RPC config changes
|
|
2552
|
+
*/
|
|
2553
|
+
cleanup() {
|
|
2554
|
+
if (this.rpcConfigUnsubscribe) {
|
|
2555
|
+
this.rpcConfigUnsubscribe();
|
|
2556
|
+
this.rpcConfigUnsubscribe = void 0;
|
|
2557
|
+
}
|
|
2558
|
+
if (this.unsubscribe) {
|
|
2559
|
+
this.unsubscribe();
|
|
2560
|
+
this.unsubscribe = void 0;
|
|
2561
|
+
}
|
|
2528
2562
|
}
|
|
2529
2563
|
/**
|
|
2530
2564
|
* Sets the externally determined, currently active WagmiConfig instance.
|
|
@@ -2706,7 +2740,9 @@ var WagmiWalletImplementation = class {
|
|
|
2706
2740
|
"getActiveConfigForManager: RainbowKit config failed, falling back to default."
|
|
2707
2741
|
);
|
|
2708
2742
|
}
|
|
2709
|
-
this.defaultInstanceConfig
|
|
2743
|
+
if (!this.defaultInstanceConfig) {
|
|
2744
|
+
this.defaultInstanceConfig = this.createDefaultConfig();
|
|
2745
|
+
}
|
|
2710
2746
|
return this.defaultInstanceConfig;
|
|
2711
2747
|
}
|
|
2712
2748
|
/**
|