@@ -517,3 +517,93 @@ const onSignAndSubmitBCSTransaction = async () => {
517517 Sign and submit BCS transaction
518518</button >;
519519```
520+
521+ ## Mobile support
522+
523+ Since Chrome extensions are not supported in mobile browsers by default, the adapter maintains a ` registry ` of undetected wallets, including a ` deeplinkProvider ` property for wallets that support deep linking.
524+ This allows the dapp to display wallets that aren’t detectable in a mobile browser view but can still be connected to by redirecting the user to an in-app browser view.
525+
526+ ``` tsx filename="registry.tsx"
527+ {
528+ name : " Petra" ,
529+ url : " https://chromewebstore.google.com/detail/petra-aptos-wallet/ejjladinnckdgjemekebdpeokbikhfci?hl=en" ,
530+ icon : " data:image/png;base64,iVBOR...QmCC" ,
531+ readyState : WalletReadyState .NotDetected ,
532+ isAIP62Standard : true ,
533+ deeplinkProvider : " https://petra.app/explore?link=" ,
534+ }
535+ ```
536+
537+ To render wallets with ` deeplinkProvider ` support in your dapp—assuming you're not using the official adapter wallet selector UI—follow these steps:
538+
539+ <Steps >
540+
541+ ### Retrieve all compatible wallets and group them by wallet type
542+
543+ ``` tsx filename="WalletDisplayDemo.tsx"
544+ import { useWallet , groupAndSortWallets } from ' @aptos-labs/wallet-adapter-react' ;
545+
546+ const displayAllWalletsDemo = () => {
547+
548+ const { wallets = [], notDetectedWallets = [] } = useWallet ();
549+
550+ const { aptosConnectWallets, availableWallets, installableWallets } =
551+ groupAndSortWallets (
552+ [... wallets , ... notDetectedWallets ]
553+ );
554+
555+ return (
556+ <div >
557+ /** Wallets that use social login to create an account on the blockchain */
558+ { aptosConnectWallets .map ((aptosConnectwallet ) => (
559+ <WalletItemComponent wallet = { aptosConnectwallet } />
560+ ))}
561+ /** Wallets that are currently installed or loadable. */
562+ { availableWallets .map ((availableWallet ) => (
563+ <WalletItemComponent wallet = { availableWallets } />
564+ ))}
565+ /** Wallets that are NOT currently installed or loadable. */
566+ { installableWallets .map ((installableWallet ) => (
567+ <WalletItemComponent wallet = { installableWallets } />
568+ ))}
569+ </div >
570+ )
571+ }
572+ ```
573+
574+ This code snippet retrieves all wallets in the Aptos ecosystem that are supported by the wallet adapter.
575+
576+ ### Display uninstalled wallets with deep link support in mobile view.
577+
578+ To ensure we display only wallets that support deep linking on mobile, we can check both for ` deepLinkProvider ` support and the current view type.
579+
580+ In the component that renders each wallet:
581+
582+ ``` tsx filename="WalletItemComponent.tsx"
583+ import { useWallet , WalletReadyState } from ' @aptos-labs/wallet-adapter-react' ;
584+
585+ const WalletItemComponent = (wallet ) => {
586+
587+ const { connect } = useWallet ();
588+
589+ // On mobile, extension wallets will never have a state of `Installed`
590+ const isWalletReady = wallet .readyState === WalletReadyState .Installed ;
591+
592+ // Check if the wallet supports mobile deep linking.
593+ const mobileSupport =
594+ " deeplinkProvider" in wallet && wallet .deeplinkProvider ;
595+
596+ // If the wallet is not installed, the user is in a redirectable view (i.e., mobile browser but not an in-app browser),
597+ // and the wallet does not support deep linking—do not display the wallet.
598+ if (! isWalletReady && isRedirectable () && ! mobileSupport ) return null ;
599+
600+ // Otherwise, display the wallet
601+ return (
602+ <Button onClick = { connect (wallet )} >{ wallet .name } </Button >
603+ )
604+ }
605+ ```
606+
607+ This code snippet ensures that the correct ` wallet ` object is displayed in the appropriate view.
608+
609+ </Steps >
0 commit comments