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

fix: do not lower address for non-EVM accounts during account creation #90

Merged
merged 9 commits into from
Nov 12, 2024

Conversation

ccharly
Copy link
Collaborator

@ccharly ccharly commented Nov 8, 2024

Some non-EVM account's addresses might be case-sensitive like Solana.

We didn't have any issue with Bitcoin native segwit addresses (since they are lower-case already), but to avoid introducing this "lower-case" behavior everywhere we will only modify the address for EVM accounts.

cc: @aganglada

We are adding the `SolAccountType` to support Solana account creation.

---------

Co-authored-by: Charly Chevalier <[email protected]>
@ccharly ccharly requested a review from a team as a code owner November 8, 2024 09:10
@ccharly ccharly force-pushed the fix/invalid-lower-cased-solana-address branch from 713e38b to 38a0c5a Compare November 8, 2024 09:14
@ccharly
Copy link
Collaborator Author

ccharly commented Nov 8, 2024

@metamaskbot publish-previews

Copy link

github-actions bot commented Nov 8, 2024

Preview builds have been published. See these instructions (from the core monorepo) for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/keyring-api": "9.0.0-38a0c5a",
  "@metamask-previews/eth-hd-keyring": "7.0.4-38a0c5a",
  "@metamask-previews/eth-ledger-bridge-keyring": "6.0.0-38a0c5a",
  "@metamask-previews/eth-simple-keyring": "6.0.5-38a0c5a",
  "@metamask-previews/eth-trezor-keyring": "4.0.0-38a0c5a",
  "@metamask-previews/eth-snap-keyring": "4.4.0-38a0c5a"
}

gantunesr
gantunesr previously approved these changes Nov 8, 2024
zone-live
zone-live previously approved these changes Nov 12, 2024
@ccharly ccharly changed the base branch from feat/solana to main November 12, 2024 09:51
@ccharly ccharly dismissed stale reviews from zone-live and gantunesr November 12, 2024 09:51

The base branch was changed.

@ccharly ccharly added this pull request to the merge queue Nov 12, 2024
Merged via the queue into main with commit 7a63f7e Nov 12, 2024
24 checks passed
@ccharly ccharly deleted the fix/invalid-lower-cased-solana-address branch November 12, 2024 10:34
throw new Error(`Account address '${account.address}' already exists`);
const address = normalizeAccountAddress(account);
if (await this.#callbacks.addressExists(address)) {
throw new Error(`Account address '${address}' already exists`);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, this was a mistake, I should have used account.address here. Now the error message uses the "normalized" address, which might be different than the one in account.

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.

4 participants