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

feat(wallet-template): add account switching #2010

Merged
merged 21 commits into from Mar 29, 2024

Conversation

ryanleecode
Copy link
Collaborator

@ryanleecode ryanleecode commented Mar 19, 2024

@ryanleecode ryanleecode marked this pull request as ready for review March 25, 2024 16:42
projects/wallet-template/.npmrc Outdated Show resolved Hide resolved
projects/wallet-template/package.json Outdated Show resolved Hide resolved
projects/wallet-template/src/background/storage.ts Outdated Show resolved Hide resolved
keysets: {
[key: string]: any
}
primaryKeysetName: string
Copy link
Contributor

Choose a reason for hiding this comment

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

let's default to the first key as primary and remove this key

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you still need to store something though. if the user selects an account, then closes the browser, and then re-opens it, the extension should remain on the same account.

Copy link
Contributor

Choose a reason for hiding this comment

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

you are right.

I wonder if could be stored in window.localStorage but I'm not sure if that storage is shared between popup and extension pages.

Copy link
Contributor

Choose a reason for hiding this comment

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

The name needs to be improved because there may be plain accounts that do not have a keyset.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can turn keyset into a typed union when we add plain accounts and then have plain accounts as a different variant. then handle each variant when decoded.

@ryanleecode ryanleecode force-pushed the feat/wallet-template/accounts-switch branch from 66e2c7c to b51752e Compare March 26, 2024 20:17
keysets: {
[key: string]: any
}
primaryKeysetName: string
Copy link
Contributor

Choose a reason for hiding this comment

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

you are right.

I wonder if could be stored in window.localStorage but I'm not sure if that storage is shared between popup and extension pages.

keysets: {
[key: string]: any
}
primaryKeysetName: string
Copy link
Contributor

Choose a reason for hiding this comment

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

The name needs to be improved because there may be plain accounts that do not have a keyset.

@ryanleecode ryanleecode force-pushed the feat/wallet-template/accounts-switch branch from daf18ee to 9dd6087 Compare March 28, 2024 17:10
@ryanleecode ryanleecode force-pushed the feat/wallet-template/accounts-switch branch from 8ef8f65 to 635d080 Compare March 29, 2024 04:56
@ryanleecode ryanleecode enabled auto-merge (squash) March 29, 2024 05:12
@ryanleecode ryanleecode merged commit 85e6827 into main Mar 29, 2024
13 checks passed
@ryanleecode ryanleecode deleted the feat/wallet-template/accounts-switch branch March 29, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants