Skip to content

Don't make me import and initialize modules #64

@chadoh

Description

@chadoh

Am I ever expected to import and use things like FreighterModule in my own app? It doesn't seem like it. I think this is just an implementation detail of StellarWalletsKit itself. If that's true, then I would love to see:

  1. Change the modules initialization param to accept a list of strings. These can be the *_ID strings that are currently used to set selectedWalletId.
  2. Stop exporting all the *Modules altogether, as they seem like an implementation detail that leaked.
  3. Changed allowAllModules exported function to a simple string, allModules

This would also allow me to code my initialization logic with more clear "exclude" rules, such as:

import { allModules, ALBEDO_ID, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit'
const kit = new StellarWalletsKit({
  modules: allModules.filter(m => m !== ALBEDO_ID)
})

So far, I have found it much more desirable to opt out of specific wallets, while benefiting from the full list of allModules supported by StellarWalletsKit.

Alternatively, in addition to the changes above, you could also add an excludeModules option.

Caveats

  • If you expect app developers to actually use *Modules in some way, you can still change the initialize parameters as described to make it easier and more expressive.
  • If you expect wallet plugin developers to use these modules, you can export them from a specific file or entrypoint, so you don't clutter the interface for your main audience, which is app developers.
    • If this audience is still hypothetical, maybe don't clutter the interface for your main audience in service of them

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions