Skip to content

Wallet plugin: only exposes filtered list of wallets #313

Description

@mcintyre94

Currently the wallet plugin provides a filtered list of wallets that can be connected to:

    function filterWallet(uiWallet: UiWallet): boolean {
        const supportsChain = uiWallet.chains.includes(config.chain);
        const supportsConnect = uiWallet.features.includes(StandardConnect);
        if (!supportsChain || !supportsConnect) return false;
        return config.filter ? config.filter(uiWallet) : true;
    }

    function buildWalletList(): readonly UiWallet[] {
        return Object.freeze(registry.get().map(getOrCreateUiWalletForStandardWallet).filter(filterWallet));
    }

This affects both the wallets list (only includes those that pass the filter), and autoconnect (if the previously connected wallet is now filtered out, we don't reconnect to it)

This is definitely the right default for most apps. But the react-app example in Kit instead renders unconnectable wallets with a warning indicator. This would not be easy to do with the wallet plugin, you'd need to use wallet-standard get() directly and compare the lists to find what's been filtered out.

If anyone wants this, it should be easy to add allWallets to the state, or potentially add filteredWallets for just the filtered ones, which might be more useful and would be simpler because it wouldn't need to churn when the not-filtered-out wallets change.

Just opening as an issue for now though, not sure anyone will need it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions