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

refactor: future-proof getInstalledWallets #51

Merged
merged 2 commits into from May 24, 2022
Merged

refactor: future-proof getInstalledWallets #51

merged 2 commits into from May 24, 2022

Conversation

delaaxe
Copy link
Contributor

@delaaxe delaaxe commented May 23, 2022

Future starknet wallets should be automatically handled using this method, independent of the way they're set on the window object.

A question remains: what if multiple wallets don't define an id? Currently only one of them would be keyed as "undefined" in this wallets object, overwriting the others. Since the key set on window is already unique for each wallet, why not use that as identifier?

@avimak
Copy link
Collaborator

avimak commented May 24, 2022

wallet's id is a mandatory field for all wallets;
originally we handled undefined to cover for legacy installations of argent, but if you guys think it's been long enough and we can now drop this special case then I'm all fwd - let's remove it and enforce the id field for all wallets (then - no overriding at all)

@delaaxe
Copy link
Contributor Author

delaaxe commented May 24, 2022

sure, thanks, that was just a question. this pr shouldn't have an impact on ids

src/index.ts Outdated
["starknet", "starknet_braavos", ...Object.keys(window)].reduce<{
[key: string]: IStarknetWindowObject;
}>((wallets, key) => {
Object.getOwnPropertyNames(window).reduce((wallets, key) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls declare Record<string, IStarknetWindowObject> here - directly on the reduce - instead of using as over line 282

@avimak avimak merged commit 8b0f643 into starknet-io:master May 24, 2022
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants