11"use client" ;
22import type { ThirdwebClient } from "../../../../client/client.js" ;
3+ import type { InAppWalletCreationOptions } from "../../../../wallets/in-app/core/wallet/types.js" ;
34import { getInstalledWalletProviders } from "../../../../wallets/injected/mipdStore.js" ;
45import type { Wallet } from "../../../../wallets/interfaces/wallet.js" ;
5- import type { WalletId } from "../../../../wallets/wallet-types.js" ;
66import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js" ;
77import {
88 fontSize ,
@@ -11,6 +11,7 @@ import {
1111 spacing ,
1212} from "../../../core/design-system/index.js" ;
1313import { useWalletInfo } from "../../../core/utils/wallet.js" ;
14+ import { Img } from "../components/Img.js" ;
1415import { Skeleton } from "../components/Skeleton.js" ;
1516import { WalletImage } from "../components/WalletImage.js" ;
1617import { Container } from "../components/basic.js" ;
@@ -22,15 +23,16 @@ import type { ConnectLocale } from "./locale/types.js";
2223 * @internal
2324 */
2425export function WalletEntryButton ( props : {
25- walletId : WalletId ;
26+ wallet : Wallet ;
2627 selectWallet : ( ) => void ;
2728 connectLocale : ConnectLocale ;
2829 recommendedWallets : Wallet [ ] | undefined ;
2930 client : ThirdwebClient ;
3031 isActive : boolean ;
3132 badge : string | undefined ;
3233} ) {
33- const { walletId, selectWallet } = props ;
34+ const { selectWallet, wallet } = props ;
35+ const walletId = wallet . id ;
3436 const isRecommended = props . recommendedWallets ?. find (
3537 ( w ) => w . id === walletId ,
3638 ) ;
@@ -45,23 +47,39 @@ export function WalletEntryButton(props: {
4547 ( p ) => p . info . rdns === walletId ,
4648 ) ;
4749
50+ const customMeta =
51+ wallet && walletId === "inApp"
52+ ? ( wallet . getConfig ( ) as InAppWalletCreationOptions ) ?. metadata
53+ : undefined ;
54+ const nameOverride = customMeta ?. name || walletName ;
55+ const iconOverride = customMeta ?. icon ;
56+
4857 return (
4958 < WalletButtonEl
5059 type = "button"
5160 onClick = { selectWallet }
5261 data-active = { props . isActive }
5362 >
54- < WalletImage id = { walletId } size = { iconSize . xl } client = { props . client } />
63+ { iconOverride ? (
64+ < Img
65+ client = { props . client }
66+ src = { iconOverride }
67+ alt = { nameOverride }
68+ width = { `${ iconSize . xl } ` }
69+ height = { `${ iconSize . xl } ` }
70+ />
71+ ) : (
72+ < WalletImage id = { walletId } size = { iconSize . xl } client = { props . client } />
73+ ) }
5574
5675 < Container flex = "column" gap = "xxs" expand >
57- { walletName ? (
76+ { nameOverride ? (
5877 < Text color = "primaryText" weight = { 600 } >
59- { walletName }
78+ { nameOverride }
6079 </ Text >
6180 ) : (
6281 < Skeleton width = "100px" height = { fontSize . md } />
6382 ) }
64-
6583 { props . badge ? (
6684 < Text size = "sm" > { props . badge } </ Text >
6785 ) : isRecommended ? (
0 commit comments