Skip to content

Commit

Permalink
feat: add coinbase wallet support (#3264)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint authored Jul 18, 2023
1 parent 34c6907 commit 8205e51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/web/src/components/Common/Providers/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { IS_MAINNET, WALLETCONNECT_PROJECT_ID } from '@lenster/data/constants';
import {
APP_NAME,
IS_MAINNET,
WALLETCONNECT_PROJECT_ID
} from '@lenster/data/constants';
import { ApolloProvider, webClient } from '@lenster/lens/apollo';
import getRpc from '@lenster/lib/getRpc';
import getLivepeerTheme from '@lib/getLivepeerTheme';
Expand All @@ -12,6 +16,7 @@ import { ThemeProvider } from 'next-themes';
import type { ReactNode } from 'react';
import { configureChains, createConfig, WagmiConfig } from 'wagmi';
import { mainnet, polygon, polygonMumbai } from 'wagmi/chains';
import { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet';
import { InjectedConnector } from 'wagmi/connectors/injected';
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
Expand All @@ -29,6 +34,7 @@ const { chains, publicClient } = configureChains(

const connectors: any = [
new InjectedConnector({ chains, options: { shimDisconnect: true } }),
new CoinbaseWalletConnector({ options: { appName: APP_NAME } }),
new WalletConnectConnector({
options: { projectId: WALLETCONNECT_PROJECT_ID },
chains
Expand Down
8 changes: 8 additions & 0 deletions packages/lib/getWalletDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ describe('getWalletDetails', () => {
);
});

test('should return correct details for Coinbase Waller', () => {
const walletDetails = getWalletDetails('Coinbase Wallet');
expect(walletDetails.name).toBe('Coinbase Wallet');
expect(walletDetails.logo).toBe(
`${STATIC_IMAGES_URL}/wallets/coinbase.svg`
);
});

test('should return correct details for name other than WalletConnect', () => {
const walletDetails = getWalletDetails('SomeOtherWallet');
expect(walletDetails.name).toBe('SomeOtherWallet');
Expand Down
5 changes: 5 additions & 0 deletions packages/lib/getWalletDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ const getWalletDetails = (name: string): WalletDetails => {
WalletConnect: {
name: 'WalletConnect',
logo: `${STATIC_IMAGES_URL}/wallets/walletconnect.svg`
},
'Coinbase Wallet': {
name: 'Coinbase Wallet',
logo: `${STATIC_IMAGES_URL}/wallets/coinbase.svg`
}
};
const defaultDetails: WalletDetails = {
name,
logo: `${STATIC_IMAGES_URL}/wallets/browser-wallet.svg`
};

return walletDetails[name] || defaultDetails;
};

Expand Down

2 comments on commit 8205e51

@vercel
Copy link

@vercel vercel bot commented on 8205e51 Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

prerender – ./apps/prerender

prerender-git-main-lenster.vercel.app
prerender-lenster.vercel.app
prerender.lenster.xyz

@vercel
Copy link

@vercel vercel bot commented on 8205e51 Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./apps/web

web-git-main-lenster.vercel.app
lenster.xyz
web-lenster.vercel.app
lenster.vercel.app

Please sign in to comment.