From 63d4e2d7997b5b43c8a069ff735eb2a752da101e Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Wed, 2 Oct 2024 09:25:52 -0300 Subject: [PATCH] fix: v5 connectors not appearing on solana (#2979) --- .../base/adapters/solana/web3js/client.ts | 6 ++++- .../src/controllers/ConnectorController.ts | 24 ++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/base/adapters/solana/web3js/client.ts b/packages/base/adapters/solana/web3js/client.ts index e579b4fff3..fa577dfc51 100644 --- a/packages/base/adapters/solana/web3js/client.ts +++ b/packages/base/adapters/solana/web3js/client.ts @@ -715,7 +715,11 @@ export class SolanaWeb3JsClient implements ChainAdapter { + /** + * This is a fix for non-serializable objects that may prevent all the connectors in the list from being displayed + * Check more about this issue on https://valtio.dev/docs/api/basic/proxy#Gotchas + */ + try { + const canProxyConnector = Boolean(proxy(connector)) + + if (!canProxyConnector) { + throw new Error('Connector is not available') + } + + return true + } catch (error) { + // eslint-disable-next-line no-console + console.error('ConnectorController.setConnectors: Not possible to add connector', { + connector, + error + }) + + return false + } + }) state.connectors = this.mergeMultiChainConnectors(state.unMergedConnectors) },