From 7c0a17d21392819563652b770f0e87015d6e5a91 Mon Sep 17 00:00:00 2001 From: Sven <38101365+svenvoskamp@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:18:32 +0100 Subject: [PATCH] hotfix: remove coinbase from default screen (#3310) --- .changeset/chilled-dingos-exercise.md | 23 +++++++++++++++++++ .../laboratory/src/pages/library/external.tsx | 1 + apps/laboratory/tests/basic-tests.spec.ts | 16 +++++++++++++ .../tests/shared/validators/ModalValidator.ts | 16 ++++++++++++- packages/adapters/ethers/src/client.ts | 11 ++------- packages/adapters/ethers5/src/client.ts | 11 ++------- packages/adapters/wagmi/src/client.ts | 1 + .../w3m-connect-external-widget/index.ts | 7 ++++-- .../w3m-connect-featured-widget/index.ts | 1 + 9 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 .changeset/chilled-dingos-exercise.md diff --git a/.changeset/chilled-dingos-exercise.md b/.changeset/chilled-dingos-exercise.md new file mode 100644 index 0000000000..d4738fc648 --- /dev/null +++ b/.changeset/chilled-dingos-exercise.md @@ -0,0 +1,23 @@ +--- +'@reown/appkit-adapter-ethers5': patch +'@reown/appkit-adapter-ethers': patch +'@reown/appkit-scaffold-ui': patch +'@apps/demo': patch +'@apps/gallery': patch +'@reown/appkit-adapter-polkadot': patch +'@reown/appkit-adapter-solana': patch +'@reown/appkit-adapter-wagmi': patch +'@reown/appkit': patch +'@reown/appkit-utils': patch +'@reown/appkit-cdn': patch +'@reown/appkit-common': patch +'@reown/appkit-core': patch +'@reown/appkit-experimental': patch +'@reown/appkit-polyfills': patch +'@reown/appkit-siwe': patch +'@reown/appkit-siwx': patch +'@reown/appkit-ui': patch +'@reown/appkit-wallet': patch +--- + +Remove coinbase from default screen diff --git a/apps/laboratory/src/pages/library/external.tsx b/apps/laboratory/src/pages/library/external.tsx index d0ae028473..2a1da60a1c 100644 --- a/apps/laboratory/src/pages/library/external.tsx +++ b/apps/laboratory/src/pages/library/external.tsx @@ -25,6 +25,7 @@ const wagmiAdapter = new WagmiAdapter({ const modal = createAppKit({ adapters: [wagmiAdapter], networks, + featuredWalletIds: ['fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'], defaultNetwork: mainnet, projectId: ConstantsUtil.ProjectId, features: { diff --git a/apps/laboratory/tests/basic-tests.spec.ts b/apps/laboratory/tests/basic-tests.spec.ts index 558d20ad7a..229e05eb9f 100644 --- a/apps/laboratory/tests/basic-tests.spec.ts +++ b/apps/laboratory/tests/basic-tests.spec.ts @@ -52,6 +52,12 @@ basicTest('Should show socials enabled by default', async () => { await modalPage.closeModal() }) +basicTest('Should not show Coinbase by default', async () => { + await modalPage.page.getByTestId('connect-button').click() + await modalValidator.expectCoinbaseNotVisible() + await modalPage.closeModal() +}) + basicTest('Should show external connectors', async ({ library }) => { if (library !== 'wagmi') { return @@ -61,3 +67,13 @@ basicTest('Should show external connectors', async ({ library }) => { await modalPage.page.getByTestId('connect-button').click() await modalValidator.expectExternalVisible() }) + +basicTest('Should show Coinbase as featured wallet', async ({ library }) => { + if (library !== 'wagmi') { + return + } + + await modalPage.page.goto(`${BASE_URL}/library/external/`) + await modalPage.page.getByTestId('connect-button').click() + await modalValidator.expectCoinbaseVisible() +}) diff --git a/apps/laboratory/tests/shared/validators/ModalValidator.ts b/apps/laboratory/tests/shared/validators/ModalValidator.ts index 603d7435c8..efd6b045f3 100644 --- a/apps/laboratory/tests/shared/validators/ModalValidator.ts +++ b/apps/laboratory/tests/shared/validators/ModalValidator.ts @@ -205,10 +205,24 @@ export class ModalValidator { } async expectExternalVisible() { - const externalConnector = this.page.getByTestId(/^wallet-selector-external/u) + const externalConnector = this.page.getByTestId( + /^wallet-selector-external-externalTestConnector/u + ) await expect(externalConnector).toBeVisible() } + async expectCoinbaseNotVisible() { + const coinbaseConnector = this.page.getByTestId(/^wallet-selector-external-coinbaseWalletSDK/u) + await expect(coinbaseConnector).not.toBeVisible() + } + + async expectCoinbaseVisible() { + const coinbaseConnector = this.page.getByTestId( + /^wallet-selector-featured-fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa/u + ) + await expect(coinbaseConnector).toBeVisible() + } + async expectMultipleAccounts() { await this.page.waitForTimeout(500) await expect(this.page.getByText('Switch Address')).toBeVisible({ diff --git a/packages/adapters/ethers/src/client.ts b/packages/adapters/ethers/src/client.ts index 2a7cf24827..5573605ce1 100644 --- a/packages/adapters/ethers/src/client.ts +++ b/packages/adapters/ethers/src/client.ts @@ -266,7 +266,7 @@ export class EthersAdapter extends AdapterBlueprint { if (this.namespace) { this.addConnector({ - id: connector, + id: key, explorerId: PresetsUtil.ConnectorExplorerIds[key], imageUrl: options?.connectorImages?.[key], name: PresetsUtil.ConnectorNamesMap[key], @@ -305,15 +305,8 @@ export class EthersAdapter extends AdapterBlueprint { if (event.detail) { const { info, provider } = event.detail const existingConnector = this.connectors?.find(c => c.name === info?.name) - const coinbaseConnector = this.connectors?.find( - c => c.id === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - ) - const isCoinbaseDuplicated = - coinbaseConnector && - event.detail.info?.rdns === - ConstantsUtil.CONNECTOR_RDNS_MAP[ConstantsUtil.COINBASE_SDK_CONNECTOR_ID] - if (!existingConnector && !isCoinbaseDuplicated) { + if (!existingConnector) { const type = PresetsUtil.ConnectorTypesMap[ConstantsUtil.EIP6963_CONNECTOR_ID] if (type && this.namespace) { diff --git a/packages/adapters/ethers5/src/client.ts b/packages/adapters/ethers5/src/client.ts index 2e18c2b2b5..079e557e69 100644 --- a/packages/adapters/ethers5/src/client.ts +++ b/packages/adapters/ethers5/src/client.ts @@ -267,7 +267,7 @@ export class Ethers5Adapter extends AdapterBlueprint { if (this.namespace) { this.addConnector({ - id: connector, + id: key, explorerId: PresetsUtil.ConnectorExplorerIds[key], imageUrl: options?.connectorImages?.[key], name: PresetsUtil.ConnectorNamesMap[key], @@ -306,15 +306,8 @@ export class Ethers5Adapter extends AdapterBlueprint { if (event.detail) { const { info, provider } = event.detail const existingConnector = this.connectors?.find(c => c.name === info?.name) - const coinbaseConnector = this.connectors?.find( - c => c.id === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID - ) - const isCoinbaseDuplicated = - coinbaseConnector && - event.detail.info?.rdns === - ConstantsUtil.CONNECTOR_RDNS_MAP[ConstantsUtil.COINBASE_SDK_CONNECTOR_ID] - if (!existingConnector && !isCoinbaseDuplicated) { + if (!existingConnector) { const type = PresetsUtil.ConnectorTypesMap[ConstantsUtil.EIP6963_CONNECTOR_ID] if (type && this.namespace) { diff --git a/packages/adapters/wagmi/src/client.ts b/packages/adapters/wagmi/src/client.ts index 26cc65a846..b4c513a80a 100644 --- a/packages/adapters/wagmi/src/client.ts +++ b/packages/adapters/wagmi/src/client.ts @@ -75,6 +75,7 @@ export class WagmiAdapter extends AdapterBlueprint { }) this.namespace = CommonConstantsUtil.CHAIN.EVM this.createConfig({ + ...configParams, networks: CaipNetworksUtil.extendCaipNetworks(configParams.networks, { projectId: configParams.projectId, customNetworkImageUrls: {} diff --git a/packages/scaffold-ui/src/partials/w3m-connect-external-widget/index.ts b/packages/scaffold-ui/src/partials/w3m-connect-external-widget/index.ts index dd262cf97b..7ec2d75b24 100644 --- a/packages/scaffold-ui/src/partials/w3m-connect-external-widget/index.ts +++ b/packages/scaffold-ui/src/partials/w3m-connect-external-widget/index.ts @@ -29,8 +29,11 @@ export class W3mConnectExternalWidget extends LitElement { // -- Render -------------------------------------------- // public override render() { const externalConnectors = this.connectors.filter(connector => connector.type === 'EXTERNAL') + const filteredOutCoinbaseConnectors = externalConnectors.filter( + connector => connector.id !== 'coinbaseWalletSDK' + ) - if (!externalConnectors?.length) { + if (!filteredOutCoinbaseConnectors?.length) { this.style.cssText = `display: none` return null @@ -38,7 +41,7 @@ export class W3mConnectExternalWidget extends LitElement { return html` - ${externalConnectors.map( + ${filteredOutCoinbaseConnectors.map( connector => html` html` this.onConnectWallet(wallet)}