Use toChecksumAddress from ethereumjs-util 4.1.0

This commit is contained in:
Alex Beregszaszi 2016-03-08 20:51:47 +00:00
parent 2c08bf5aa4
commit fed7bcde9a
2 changed files with 2 additions and 14 deletions

View File

@ -42,19 +42,7 @@ Wallet.prototype.getAddressString = function () {
}
Wallet.prototype.getChecksumAddressString = function () {
var address = this.getAddress().toString('hex')
var hash = ethUtil.sha3(address).toString('hex')
var ret = '0x'
for (var i = 0; i < address.length; i++) {
if (parseInt(hash[i], 16) >= 8) {
ret += address[i].toUpperCase()
} else {
ret += address[i]
}
}
return ret
return ethUtil.toChecksumAddress(this.getAddressString())
}
// https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition

View File

@ -24,7 +24,7 @@
},
"homepage": "https://github.com/axic/ethereumjs-wallet",
"dependencies": {
"ethereumjs-util": "^4.0.0",
"ethereumjs-util": "^4.1.0",
"scrypt.js": "^0.1.0",
"uuid": "^2.0.1"
},