Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit fed7bcd

Browse files
committed
Use toChecksumAddress from ethereumjs-util 4.1.0
1 parent 2c08bf5 commit fed7bcd

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

index.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,7 @@ Wallet.prototype.getAddressString = function () {
4242
}
4343

4444
Wallet.prototype.getChecksumAddressString = function () {
45-
var address = this.getAddress().toString('hex')
46-
var hash = ethUtil.sha3(address).toString('hex')
47-
var ret = '0x'
48-
49-
for (var i = 0; i < address.length; i++) {
50-
if (parseInt(hash[i], 16) >= 8) {
51-
ret += address[i].toUpperCase()
52-
} else {
53-
ret += address[i]
54-
}
55-
}
56-
57-
return ret
45+
return ethUtil.toChecksumAddress(this.getAddressString())
5846
}
5947

6048
// https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"homepage": "https://github.com/axic/ethereumjs-wallet",
2626
"dependencies": {
27-
"ethereumjs-util": "^4.0.0",
27+
"ethereumjs-util": "^4.1.0",
2828
"scrypt.js": "^0.1.0",
2929
"uuid": "^2.0.1"
3030
},

0 commit comments

Comments
 (0)