Skip to content

Commit

Permalink
fix: finding network with local storage id value
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk committed Dec 10, 2024
1 parent 7833dca commit 3482663
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/appkit/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ export class AppKit {
this.setStatus('connected', chainNamespace)

if (chainIdToUse && chainNamespace === activeNamespace) {
const caipNetwork = this.caipNetworks?.find(n => n.id === chainIdToUse)
const caipNetwork = this.caipNetworks?.find(n => n.id.toString() === chainIdToUse.toString())
const fallBackCaipNetwork = this.caipNetworks?.find(n => n.chainNamespace === chainNamespace)
this.setCaipNetwork(caipNetwork || fallBackCaipNetwork)
this.syncConnectedWalletInfo(chainNamespace)
Expand All @@ -1520,7 +1520,7 @@ export class AppKit {
const caipNetwork = NetworkUtil.getNetworksByNamespace(
this.caipNetworks,
params.chainNamespace
).find(n => n.id === params.chainId)
).find(n => n.id.toString() === params.chainId.toString())

if (!caipNetwork) {
return
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/controllers/ChainController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export const ChainController = {
initialize(adapters: ChainAdapter[], caipNetworks: CaipNetwork[] | undefined) {
const { chainId: activeChainId, namespace: activeNamespace } =
StorageUtil.getActiveNetworkProps()
const activeCaipNetwork = caipNetworks?.find(network => network.id === activeChainId)
const activeCaipNetwork = caipNetworks?.find(
network => network.id.toString() === activeChainId?.toString()
)
const defaultAdapter = adapters.find(adapter => adapter?.namespace === activeNamespace)
const adapterToActivate = defaultAdapter || adapters?.[0]

Expand Down

0 comments on commit 3482663

Please sign in to comment.