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

Problem deleting account when checksummed address is equal to lowercase address #5049

Closed
1 task done
pietro-lopes opened this issue May 18, 2022 · 1 comment · Fixed by #5050
Closed
1 task done
Labels
1.x 1.0 related issues Bug Addressing a bug

Comments

@pietro-lopes
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When you add an account to a wallet, it creates:

  • An index;
  • A checksummed address;
  • A lowercase address.

So you can access using any of those keys.

When you want to remove an account it does the same process, but when you have a checksummed that is equal to lowercase, the line (681) that access the lowercase address will throw an exception because it doesn't exists anymore.

Uncaught TypeError TypeError: Cannot set properties of undefined (setting 'privateKey')

Expected Behavior

No error.

Steps to Reproduce

const Accounts = require('web3-eth-accounts')

const accounts = new Accounts()
// add an account address that lowercase and checksummed are equal : 0x92b7254537e2890f728187988b829b28a01333ce
accounts.wallet.add('0xaa237230fc60e46175256cbc931852514364089a9f4e5b59b5217483b2df4df7') // not used pvt key, don't worry
// remove account with index 0
accounts.wallet.remove(0)

https://github.com/ChainSafe/web3.js/blob/2c0324af2da467ee1acb72452f20000e916e4306/packages/web3-eth-accounts/src/index.js#L673-L693

Web3.js Version

1.7.3

Environment

  • Operating System: Windows 10 Pro
  • Browser: None
  • Node.js Version: v16.13.2
  • NPM Version: 8.1.2

Anything Else?

No response

@pietro-lopes pietro-lopes added the Bug Addressing a bug label May 18, 2022
andreistefanwork pushed a commit to andreistefanwork/web3.js that referenced this issue May 18, 2022
andreistefanwork pushed a commit to andreistefanwork/web3.js that referenced this issue May 18, 2022
@andreistefanwork
Copy link

Hi @UnknownRJ!

I am also able to reproduce the issue; I'm happy to help and I have tried fixing the problem & created a PR

Can you please have a look if everything looks fine?

Thanks!

@nazarhussain nazarhussain added the 1.x 1.0 related issues label May 18, 2022
andreistefanwork pushed a commit to andreistefanwork/web3.js that referenced this issue May 18, 2022
andreistefanwork added a commit to andreistefanwork/web3.js that referenced this issue May 22, 2022
…lowercase are equal web3#5049

Signed-off-by: Andrei Stefan <andrei.stefan.work@gmail.com>
andreistefanwork added a commit to andreistefanwork/web3.js that referenced this issue Jun 4, 2022
andreistefanwork added a commit to andreistefanwork/web3.js that referenced this issue Jun 16, 2022
andreistefanwork added a commit to andreistefanwork/web3.js that referenced this issue Jun 23, 2022
andreistefanwork added a commit to andreistefanwork/web3.js that referenced this issue Jun 23, 2022
andreistefanwork added a commit to andreistefanwork/web3.js that referenced this issue Jun 23, 2022
andreistefanwork added a commit to andreistefanwork/web3.js that referenced this issue Jun 28, 2022
jdevcs added a commit that referenced this issue Jul 5, 2022
…lowercase are equal #5049 (#5050)

Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com>
jdevcs added a commit that referenced this issue Jul 5, 2022
…lowercase are equal #5049 (#5050) (#5202)

Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com>

Co-authored-by: Andrei Stefan <andrei.stefan.work@gmail.com>
@jdevcs jdevcs closed this as completed Jul 5, 2022
@jdevcs jdevcs mentioned this issue Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug
Projects
None yet
4 participants