From ee24dea79ac518268cef917d42d1d7932e8e10fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 28 May 2018 10:13:11 +0200 Subject: [PATCH] Use EIP 55 for ethereum getAddress --- package.json | 1 + src/helpers/getAddressForCurrency/ethereum.js | 6 ++++-- yarn.lock | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d1c29f86..52bcc28d 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "d3": "^5.1.0", "debug": "^3.1.0", "downshift": "^1.31.9", + "eip55": "^1.0.3", "electron-store": "^1.3.0", "electron-updater": "^2.21.8", "ethereumjs-tx": "^1.3.4", diff --git a/src/helpers/getAddressForCurrency/ethereum.js b/src/helpers/getAddressForCurrency/ethereum.js index 604de42b..6f4d8021 100644 --- a/src/helpers/getAddressForCurrency/ethereum.js +++ b/src/helpers/getAddressForCurrency/ethereum.js @@ -2,6 +2,7 @@ import Eth from '@ledgerhq/hw-app-eth' import type Transport from '@ledgerhq/hw-transport' +import eip55 from 'eip55' export default async ( transport: Transport<*>, @@ -10,6 +11,7 @@ export default async ( { verify = false }: { verify: boolean }, ) => { const eth = new Eth(transport) - const { address, publicKey } = await eth.getAddress(path, verify) - return { path, address, publicKey } + const r = await eth.getAddress(path, verify) + const address = eip55.encode(r.address) + return { path, address, publicKey: r.publicKey } } diff --git a/yarn.lock b/yarn.lock index ad76738f..61f19921 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5493,6 +5493,12 @@ ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" +eip55@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/eip55/-/eip55-1.0.3.tgz#a927e6850aed8d8a34ed496d629bb3a7bfb037f2" + dependencies: + keccak "^1.3.0" + ejs@^2.5.7, ejs@^2.5.9, ejs@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0" @@ -8587,7 +8593,7 @@ jsx-ast-utils@^2.0.0, jsx-ast-utils@^2.0.1: dependencies: array-includes "^3.0.3" -keccak@^1.0.2: +keccak@^1.0.2, keccak@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/keccak/-/keccak-1.4.0.tgz#572f8a6dbee8e7b3aa421550f9e6408ca2186f80" dependencies: