From 90ba7c390d26b34923e1a88268b3143906d30c4e Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Fri, 13 Sep 2024 11:21:52 -0300 Subject: [PATCH] fix: solana default chain logic (#2849) --- apps/laboratory/src/pages/library/solana.tsx | 1 - .../base/adapters/solana/web3js/client.ts | 27 +++++++++---------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/apps/laboratory/src/pages/library/solana.tsx b/apps/laboratory/src/pages/library/solana.tsx index a932d9b084..137fc71bff 100644 --- a/apps/laboratory/src/pages/library/solana.tsx +++ b/apps/laboratory/src/pages/library/solana.tsx @@ -19,7 +19,6 @@ const modal = createWeb3Modal({ solanaConfig, projectId: ConstantsUtil.ProjectId, metadata: ConstantsUtil.Metadata, - defaultChain: solana, chains, enableAnalytics: false, termsConditionsUrl: 'https://walletconnect.com/terms', diff --git a/packages/base/adapters/solana/web3js/client.ts b/packages/base/adapters/solana/web3js/client.ts index 6295307d30..0d96026f5e 100644 --- a/packages/base/adapters/solana/web3js/client.ts +++ b/packages/base/adapters/solana/web3js/client.ts @@ -87,9 +87,7 @@ export class SolanaWeb3JsClient implements ChainAdapter c.chainId === defaultChain?.chainId) + this.defaultChain = SolHelpersUtil.getChainFromCaip( + this.chains, + SafeLocalStorage.getItem(SolConstantsUtil.CAIP_CHAIN_ID) || + withSolanaNamespace(defaultChain?.chainId) || + withSolanaNamespace(chains[0]?.chainId) + ) this.networkControllerClient = { switchCaipNetwork: async caipNetwork => { @@ -291,13 +288,13 @@ export class SolanaWeb3JsClient implements ChainAdapter withSolanaNamespace(c.chainId) === this.defaultChain.id) + if (chain) { + SolStoreUtil.setCurrentChain(chain) + } } this.syncNetwork()