Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New MetaMask logo #1381

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/stateful/components/WalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ import {
import { useSyncWalletSigner, useWallet } from '../hooks'
import { WalletUi } from './wallet'

// Set better name for MetaMask wallet.
metamaskWallets[0].walletInfo.prettyName = 'MetaMask (Leap Snap)'

export type WalletProviderProps = {
// This needs to be provided by the parent component and then passed to the
// AppContext that wraps the app. Since the AppContext uses the inbox which
Expand Down Expand Up @@ -173,7 +176,7 @@ export const WalletProvider = ({
...keplrExtensionWallets,
// Only allow Keplr Mobile on mainnet since it can't use testnet.
...(MAINNET ? keplrMobileWallets : []),
...leapWallets,
...leapWallets.filter((w) => !metamaskWallets.includes(w)),
...stationWallets,
...vectisWallets,
...trustWallets,
Expand Down
48 changes: 31 additions & 17 deletions packages/stateful/components/wallet/WalletUiWalletList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainWalletBase, WalletModalProps } from '@cosmos-kit/core'
import { ChainWalletBase, Wallet, WalletModalProps } from '@cosmos-kit/core'
import clsx from 'clsx'
import { useTranslation } from 'react-i18next'

Expand Down Expand Up @@ -54,14 +54,7 @@ export const WalletUiWalletList = ({
}
variant="secondary"
>
{!!wallet.walletInfo.logo && (
<div
className="h-10 w-10 bg-contain bg-center bg-no-repeat"
style={{
backgroundImage: `url(${wallet.walletInfo.logo})`,
}}
/>
)}
<WalletImage logo={wallet.walletInfo.logo} />

<p className="secondary-text text-center">
{wallet.walletInfo.prettyName}
Expand Down Expand Up @@ -109,14 +102,7 @@ export const WalletUiWalletList = ({
}
variant="secondary"
>
{!!wallet.walletInfo.logo && (
<div
className="h-10 w-10 bg-contain bg-center bg-no-repeat"
style={{
backgroundImage: `url(${wallet.walletInfo.logo})`,
}}
/>
)}
<WalletImage logo={wallet.walletInfo.logo} />
</Button>
</Tooltip>
))}
Expand All @@ -126,3 +112,31 @@ export const WalletUiWalletList = ({
</div>
)
}

export type WalletImageProps = {
logo: Wallet['logo']
}

export const WalletImage = ({ logo }: WalletImageProps) =>
typeof logo === 'string' ? (
<div
className="h-10 w-10 bg-contain bg-center bg-no-repeat"
style={{
backgroundImage: `url(${logo})`,
}}
/>
) : logo && 'major' in logo ? (
<div
className="relative h-10 w-10 bg-contain bg-center bg-no-repeat"
style={{
backgroundImage: `url(${logo.major})`,
}}
>
<div
className="absolute -right-1 -bottom-1 h-4 w-4 bg-contain bg-center"
style={{
backgroundImage: `url(${logo.minor})`,
}}
/>
</div>
) : null
36 changes: 18 additions & 18 deletions packages/stateful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
"@cosmjs/encoding": "^0.31.0",
"@cosmjs/proto-signing": "^0.31.0",
"@cosmjs/stargate": "^0.31.0",
"@cosmos-kit/coin98": "^2.3.6",
"@cosmos-kit/core": "^2.6.2",
"@cosmos-kit/cosmostation": "^2.3.7",
"@cosmos-kit/fin": "^2.3.8",
"@cosmos-kit/keplr-extension": "^2.4.3",
"@cosmos-kit/keplr-mobile": "^2.3.6",
"@cosmos-kit/leap": "^2.3.6",
"@cosmos-kit/leap-metamask-cosmos-snap": "^0.2.0",
"@cosmos-kit/ledger": "^2.4.3",
"@cosmos-kit/okxwallet": "^2.2.7",
"@cosmos-kit/omni": "^2.3.6",
"@cosmos-kit/react-lite": "^2.4.8",
"@cosmos-kit/shell": "^2.3.6",
"@cosmos-kit/station": "^2.3.7",
"@cosmos-kit/trust": "^2.3.6",
"@cosmos-kit/vectis": "^2.3.6",
"@cosmos-kit/web3auth": "^2.3.6",
"@cosmos-kit/xdefi-extension": "^2.4.3",
"@cosmos-kit/coin98": "^2.3.8",
"@cosmos-kit/core": "^2.6.4",
"@cosmos-kit/cosmostation": "^2.3.9",
"@cosmos-kit/fin": "^2.3.10",
"@cosmos-kit/keplr-extension": "^2.4.7",
"@cosmos-kit/keplr-mobile": "^2.3.8",
"@cosmos-kit/leap": "^2.3.8",
"@cosmos-kit/leap-metamask-cosmos-snap": "^0.2.2",
"@cosmos-kit/ledger": "^2.4.5",
"@cosmos-kit/okxwallet": "^2.2.9",
"@cosmos-kit/omni": "^2.3.8",
"@cosmos-kit/react-lite": "^2.4.10",
"@cosmos-kit/shell": "^2.3.8",
"@cosmos-kit/station": "^2.3.9",
"@cosmos-kit/trust": "^2.3.8",
"@cosmos-kit/vectis": "^2.3.8",
"@cosmos-kit/web3auth": "^2.3.8",
"@cosmos-kit/xdefi-extension": "^2.4.5",
"@dao-dao/i18n": "2.2.0",
"@dao-dao/protobuf": "2.2.0",
"@dao-dao/state": "2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"devDependencies": {
"@chain-registry/types": "^0.16.0",
"@cosmjs/cosmwasm-stargate": "^0.31.0",
"@cosmos-kit/web3auth": "^2.3.6",
"@cosmos-kit/web3auth": "^2.3.8",
"@dao-dao/config": "2.2.0",
"next-i18next": "^11.0.0",
"pusher-js": "^7.6.0",
Expand Down
Loading