Skip to content

Commit

Permalink
feat: add email, sms, and metamask extension
Browse files Browse the repository at this point in the history
  • Loading branch information
chalabi2 committed Dec 9, 2024
1 parent 215915e commit f059f3b
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 11 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion components/react/views/Connected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const Connected = ({
<Image
height={0}
width={0}
src={getRealLogo(logo)}
src={name === 'Cosmos MetaMask Extension' ? '/metamask.svg' : getRealLogo(logo)}

Check warning on line 60 in components/react/views/Connected.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/Connected.tsx#L60

Added line #L60 was not covered by tests
alt={name}
className="w-8 h-8 rounded-full mr-2"
/>
Expand Down
2 changes: 1 addition & 1 deletion components/react/views/Connecting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const Connecting = ({
</div>
<div className="flex flex-col w-full h-full mt-4 sm:px-8 sm:py-6">
<img
src={getRealLogo(logo)}
src={name === 'Cosmos MetaMask Extension' ? '/metamask.svg' : getRealLogo(logo)}

Check warning on line 46 in components/react/views/Connecting.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/Connecting.tsx#L46

Added line #L46 was not covered by tests
alt={name}
className="flex-shrink-0 w-20 h-20 mx-auto aspect-1"
/>
Expand Down
6 changes: 5 additions & 1 deletion components/react/views/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export const Error = ({
<div className="flex flex-col w-full h-full py-6 mt-4 sm:px-8">
<div className="p-3 border rounded-full border-red-600 mx-auto aspect-1 flex-shrink-0">
<Image
src={getRealLogo(logo)}
src={
currentWalletName === 'Cosmos MetaMask Extension'
? '/metamask.svg'
: getRealLogo(logo)
}

Check warning on line 52 in components/react/views/Error.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/Error.tsx#L48-L52

Added lines #L48 - L52 were not covered by tests
alt="Wallet type logo"
className="flex-shrink-0 w-16 h-16 aspect-1"
width={16}
Expand Down
2 changes: 1 addition & 1 deletion components/react/views/NotExist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const NotExist = ({
</div>
<div className="flex flex-col w-full h-full py-6 mt-4 sm:px-8">
<img
src={getRealLogo(logo)}
src={name === 'Cosmos MetaMask Extension' ? '/metamask.svg' : getRealLogo(logo)}

Check warning on line 43 in components/react/views/NotExist.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/NotExist.tsx#L43

Added line #L43 was not covered by tests
alt={name}
className="flex-shrink-0 w-16 h-16 mx-auto aspect-1"
/>
Expand Down
20 changes: 14 additions & 6 deletions components/react/views/WalletList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ export const WalletList = ({
const isDarkMode = document.documentElement.classList.contains('dark');

const social = wallets.filter(wallet =>
['Google', 'Twitter', 'Apple', 'Discord', 'GitHub', 'Reddit'].includes(
['Google', 'Twitter', 'Apple', 'Discord', 'GitHub', 'Reddit', 'Email', 'SMS'].includes(

Check warning on line 18 in components/react/views/WalletList.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/WalletList.tsx#L18

Added line #L18 was not covered by tests
wallet.walletInfo.prettyName
)
);

const browser = wallets.filter(wallet =>
['Keplr', 'Cosmostation', 'Leap', 'Station'].includes(wallet.walletInfo.prettyName)
['Keplr', 'Cosmostation', 'Leap', 'Station', 'Cosmos MetaMask Extension'].includes(
wallet.walletInfo.prettyName
)

Check warning on line 26 in components/react/views/WalletList.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/WalletList.tsx#L24-L26

Added lines #L24 - L26 were not covered by tests
);

console.log(wallets);

Check warning on line 28 in components/react/views/WalletList.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/WalletList.tsx#L28

Added line #L28 was not covered by tests
const mobile = wallets.filter(wallet =>
['Wallet Connect', 'Keplr Mobile', 'Cosmostation Mobile', 'Leap Mobile'].includes(
wallet.walletInfo.prettyName
Expand All @@ -40,7 +42,7 @@ export const WalletList = ({
<XMarkIcon className="w-5 h-5" aria-hidden="true" />
</button>

{/* Browser and Social sections - browaer hidden on mobile/tablet */}
{/* Browser and Social sections - browser hidden on mobile/tablet */}

Check warning on line 45 in components/react/views/WalletList.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/WalletList.tsx#L45

Added line #L45 was not covered by tests
<div className="hidden md:block">
<div className="space-y-2 mb-4">
{browser.map(({ walletInfo: { name, prettyName, logo } }) => (
Expand All @@ -50,11 +52,17 @@ export const WalletList = ({
className="flex items-center w-full p-3 rounded-lg dark:bg-[#ffffff0c] bg-[#f0f0ff5c] dark:hover:bg-[#0000004c] hover:bg-[#a8a8a84c] transition"
>
<img
src={getRealLogo(logo?.toString() ?? '')}
src={
prettyName === 'Cosmos MetaMask Extension'
? '/metamask.svg'
: getRealLogo(logo?.toString() ?? '')
}

Check warning on line 59 in components/react/views/WalletList.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/WalletList.tsx#L55-L59

Added lines #L55 - L59 were not covered by tests
alt={prettyName}
className="w-10 h-10 rounded-xl mr-3"
/>
<span className="text-md">{prettyName}</span>
<span className="text-md">
{prettyName === 'Cosmos MetaMask Extension' ? 'MetaMask' : prettyName}
</span>

Check warning on line 65 in components/react/views/WalletList.tsx

View check run for this annotation

Codecov / codecov/patch

components/react/views/WalletList.tsx#L63-L65

Added lines #L63 - L65 were not covered by tests
</button>
))}
</div>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@chain-registry/assets": "^1.64.83",
"@cosmjs/cosmwasm-stargate": "0.32.4",
"@cosmjs/stargate": "npm:@liftedinit/[email protected]",
"@cosmos-kit/cosmos-extension-metamask": "^0.12.1",
"@cosmos-kit/react": "2.18.0",
"@cosmos-kit/web3auth": "2.11.0",
"@fontsource/manrope": "^5.0.21",
Expand Down
13 changes: 12 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
manifestTestnetAssets,
} from '@/config';
import { SignerOptions, wallets } from 'cosmos-kit';
import { wallets as cosmosExtensionWallets } from '@cosmos-kit/cosmos-extension-metamask';
import { ChainProvider } from '@cosmos-kit/react';
import { Registry } from '@cosmjs/proto-signing';
import { TailwindModal } from '../components';
Expand Down Expand Up @@ -145,6 +146,16 @@ function ManifestApp({ Component, pageProps }: ManifestAppProps) {
name: 'Reddit',
logo: '/reddit',
},
{
provider: 'email_passwordless',
name: 'Email',
logo: '/email',
},
{
provider: 'sms_passwordless',
name: 'SMS',
logo: '/sms',
},
],

client: {
Expand All @@ -167,7 +178,7 @@ function ManifestApp({ Component, pageProps }: ManifestAppProps) {
);

// combine the web3auth wallets with the other wallets
const combinedWallets = [...web3AuthWallets, ...wallets];
const combinedWallets = [...web3AuthWallets, ...wallets, ...cosmosExtensionWallets];

// this is stop ssr errors when we render the web3auth signing modal
const [isBrowser, setIsBrowser] = useState(false);
Expand Down
7 changes: 7 additions & 0 deletions public/browser-wallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/email_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/email_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions public/metamask.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/sms_dark copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/sms_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f059f3b

Please sign in to comment.