Use toChecksumAddress from ethereumjs-util 4.1.0
This commit is contained in:
parent
2c08bf5aa4
commit
fed7bcde9a
14
index.js
14
index.js
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue