Integration with dApps on Mirage Wallet
To determine if users are accessing your dApp through Mirage, check for the existence of the following object:
If this object is undefined, it means the user is not accessing your dApp via Mirage Wallet's in-app browser.
Your dApp should seamlessly function on Mirage Wallet without additional adjustments.
Furthermore, the window.mirage object serves as a pointer to window.metamask, implying that the underlying methods and properties will align.
To redirect users from your dApp to Mirage Wallet, utilize the following deep link:
For a direct redirection of users to your dApp within Mirage's in-app browser, employ this deep link:
Copy codemirage://wallet/dapps?network=BSC&url=https%3A%2F%2Fcard.mirage Parameters in the deep link:
network: Chain ID of the network your dApp connects to.
url: URL-encoded URL of your dApp.
Example (provided by SCRT Labs):
Copy codeconst urlSearchParams = new URLSearchParams () ;
urlSearchParams . append ( " network " , " BSC " ) ;
urlSearchParams . append ( " url " , window . location . href ) ;
window . open ( ` mirage://wallet/dapps? ${ urlSearchParams . toString () } ` , " _blank " ) ; This example generates a deep link to redirect users from your dApp to Mirage's in-app browser, carrying the specified network and your dApp's encoded URL.