You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we use an isPeraDiscoverBrowser property within Pera Connect to detect if the dApp is opened within the Pera Discover Browser. When this property returns true, we bypass the typical wallet selection screen and directly initiate the Pera Connect connection, providing a smoother user experience. Reference
In use-wallet, the default flow initiates the wallet selection screen immediately after the "Connect wallet" button is clicked. This works well in general scenarios, but in cases where isPeraDiscoverBrowser is true, it would be more efficient to skip this step and auto-connect with Pera Connect.
The only workaround I see is listing only the PeraWallet option, but this isn't ideal, especially since the "Connect wallet" button is controlled by the dApp and cannot be manipulated externally.
Is there a way to incorporate isPeraDiscoverBrowser into use-wallet to enable an auto-connect flow when detected?
The text was updated successfully, but these errors were encountered:
Currently the library waits until a wallet provider's connect method is invoked for the first time to lazily load its dependencies. This is a performance optimization for apps that are configured to support multiple wallets. If a wallet isn't used its dependencies are never loaded.
The auto-connect flow would require bypassing this behavior in the Pera provider. Pera Connect would need to be loaded every time the app mounts, whether the user is on a mobile device using the Discover browser or not. I'd like to give developers a way to opt-in to this behavior.
There are two approaches that would work:
Expose a configuration property like autoConnect: true to signal that the provider should load the module right away
The app imports the module and passes it directly to a property like staticModule: PeraWalletConnect
With the module available in the constructor, the client is initialized and conditionally triggers the automatic connection.
I'm leaning towards option 2, because it aligns with a change I'm considering for the next major release. Lazy loading by default prohibits the library from being used in projects that don't support dynamic imports. Actually I think it makes sense to save this feature for v4.0.0 so it can be incorporated with the broader change.
I'll tag you @yasincaliskan in the PR when the feature is ready to review.
Currently, we use an
isPeraDiscoverBrowser
property within Pera Connect to detect if the dApp is opened within the Pera Discover Browser. When this property returns true, we bypass the typical wallet selection screen and directly initiate the Pera Connect connection, providing a smoother user experience. ReferenceIn use-wallet, the default flow initiates the wallet selection screen immediately after the "Connect wallet" button is clicked. This works well in general scenarios, but in cases where
isPeraDiscoverBrowser
is true, it would be more efficient to skip this step and auto-connect with Pera Connect.The only workaround I see is listing only the PeraWallet option, but this isn't ideal, especially since the "Connect wallet" button is controlled by the dApp and cannot be manipulated externally.
Is there a way to incorporate
isPeraDiscoverBrowser
into use-wallet to enable an auto-connect flow when detected?The text was updated successfully, but these errors were encountered: