Skip to content

Commit

Permalink
hotfix: remove coinbase from default screen (#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvoskamp authored Nov 25, 2024
1 parent 1f586a2 commit 7c0a17d
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 21 deletions.
23 changes: 23 additions & 0 deletions .changeset/chilled-dingos-exercise.md
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions apps/laboratory/src/pages/library/external.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const wagmiAdapter = new WagmiAdapter({
const modal = createAppKit({
adapters: [wagmiAdapter],
networks,
featuredWalletIds: ['fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'],
defaultNetwork: mainnet,
projectId: ConstantsUtil.ProjectId,
features: {
Expand Down
16 changes: 16 additions & 0 deletions apps/laboratory/tests/basic-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
})
16 changes: 15 additions & 1 deletion apps/laboratory/tests/shared/validators/ModalValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
11 changes: 2 additions & 9 deletions packages/adapters/ethers/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 2 additions & 9 deletions packages/adapters/ethers5/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions packages/adapters/wagmi/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ 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
}

return html`
<wui-flex flexDirection="column" gap="xs">
${externalConnectors.map(
${filteredOutCoinbaseConnectors.map(
connector => html`
<wui-list-wallet
imageSrc=${ifDefined(AssetUtil.getConnectorImage(connector))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class W3mConnectFeaturedWidget extends LitElement {
${wallets.map(
wallet => html`
<wui-list-wallet
data-testid=${`wallet-selector-featured-${wallet.id}`}
imageSrc=${ifDefined(AssetUtil.getWalletImage(wallet))}
name=${wallet.name ?? 'Unknown'}
@click=${() => this.onConnectWallet(wallet)}
Expand Down

0 comments on commit 7c0a17d

Please sign in to comment.