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

NightlyConnect pops up when no wallet installed #67

Closed
niklasp opened this issue Mar 13, 2024 · 2 comments
Closed

NightlyConnect pops up when no wallet installed #67

niklasp opened this issue Mar 13, 2024 · 2 comments

Comments

@niklasp
Copy link
Contributor

niklasp commented Mar 13, 2024

When there are no wallets installed i would not expect to see a nightly connect popup per default.

There is a little bug in the code, as isWalletInstalled always returns true for nightly

if (wallet.id === nightlyConnect.id) return true

const wallets = allSubstrateWallets.filter((w) => isWalletInstalled(w))
if (!wallets?.length) {
const message = 'No Substrate-compatible extension detected'
setError({
code: UseInkathonErrorCode.NoSubstrateExtensionDetected,
message,
})
throw new Error(message)
}
// Determine wallet to use
const preferredWallet = wallet && wallets.find((w) => w.id === wallet.id)
const _wallet = preferredWallet || wallets[0]

wallets will never be [] and so nightlyWallet will always be the preferredWallet that is tried to enable, also if no wallets are installed.

What do you think about tackling this in a feature-add-workaround where instead of using allSubstrateWallets add a supportedWallets value to the provider that defaults to allSubstrateWallets and working with that instead in the provider. I am asking because I had to limit the supported wallets in my dapps and it would solve the issue for all not adding nightlyWallet to the supportedWallets

@niklasp
Copy link
Contributor Author

niklasp commented Mar 16, 2024

My problem is that i cannot use useInkathon the way it is now as I do not want to support NightlyConnect and see no way to workaround except changing the library. Happy to submit a PR if you agree or come up with other ideas on how to handle.

@wottpal
Copy link
Member

wottpal commented Apr 9, 2024

This is fixed in @scio-labs/use-inkathon@0.9.0 which no longer automatically opens Nightly Connect on the initial/auto-connect.

Additionally, it contains your PR #68 which I've merged. Though, I would recommend only using it when there is a good reason for it (Nightly Connect is now disabled on init so this shouldn't be one). Why? IMO it leads towards developers artificially excluding users by not-enabling certain wallets. And also when new wallets get added to the eco/repo they need to manually upgrade their dApps to be compatible which I would advice against as the default.

@wottpal wottpal closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants