Skip to content

Commit

Permalink
fix remove wallet using an index when an account address and address …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
jdevcs and andreistefanwork committed Jul 5, 2022
1 parent 2a1308f commit 46b5a5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ Released with 1.0.0-beta.37 code base.

### Fixed
- Fix typos in web3-eth-accounts.rst & TESTING.md (#5047)
- Fix remove wallet using an index when an account address and address lowercase are equal (#5049)
- Improve README.md & Fix typos (#4848)
- Add optional hex formatting parameter for getTransactionrReceipt (#5153)
- Fix transactionRoot -> transactionsRoot in BlockHeader (#5083)
Expand Down
6 changes: 4 additions & 2 deletions packages/web3-eth-accounts/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,10 @@ Wallet.prototype.remove = function(addressOrIndex) {
this[account.address].privateKey = null;
delete this[account.address];
// address lowercase
this[account.address.toLowerCase()].privateKey = null;
delete this[account.address.toLowerCase()];
if (this[account.address.toLowerCase()]) {
this[account.address.toLowerCase()].privateKey = null;
delete this[account.address.toLowerCase()];
}
// index
this[account.index].privateKey = null;
delete this[account.index];
Expand Down
6 changes: 6 additions & 0 deletions test/eth.accounts.wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ var tests = [
data: 'Some data!%$$%&@*',
// signature done with personal_sign
signature: '0x05252412b097c5d080c994d1ea12abcee6f1cae23feb225517a0b691a66e12866b3f54292f9cfef98f390670b4d010fc4af7fcd46e41d72870602c117b14921c1c'
}, {
address: '0x92b7254537e2890f728187988b829b28a01333ce',
privateKey: '0xaa237230fc60e46175256cbc931852514364089a9f4e5b59b5217483b2df4df7',
data: 'Some data!%$$%&@*',
// signature done with personal_sign
signature: '0xb9772194346dbf4fabf34e47f6305edf25c3de0b26b2b85f4778b49c1990115149ba4bf730ae3f9cd303769bb5bdcdf564e3a467ae061031dc368aab798fec091b'
}
];

Expand Down

0 comments on commit 46b5a5b

Please sign in to comment.