diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 77772408e320..000000000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: node_js -env: - - CXX=g++-4.8 -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 -node_js: - - "5.1" -before_script: - - npm install -g mocha diff --git a/CHANGELOG.md b/CHANGELOG.md index 552dae3c25f0..ca82f3ba1a3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#323](https://github.com/poanetwork/nifty-wallet/pull/323) - (Chore) update Mainnet tokens metadata - [#322](https://github.com/poanetwork/nifty-wallet/pull/322) - (Fix) Update explorers links - [#318](https://github.com/poanetwork/nifty-wallet/pull/318) - (Fix) pasting of ABI for contract type account +- [#317](https://github.com/poanetwork/nifty-wallet/pull/317) - (Fix) path to derive accounts in HD wallets for RSK, ETC ## 4.11.10 Tue Feb 04 2020 diff --git a/app/scripts/controllers/network/createPocketClient.js b/app/scripts/controllers/network/createPocketClient.js index 51836c547d9e..392b7221994b 100644 --- a/app/scripts/controllers/network/createPocketClient.js +++ b/app/scripts/controllers/network/createPocketClient.js @@ -8,43 +8,16 @@ const createBlockTrackerInspectorMiddleware = require('eth-json-rpc-middleware/b const providerFromMiddleware = require('eth-json-rpc-middleware/providerFromMiddleware') const createPocketMiddleware = require('json-rpc-pocket') const BlockTracker = require('eth-block-tracker') +const { getNetworkID } = require('../../../../old-ui/app/util') const devid = 'DEVVGQ8VfHgBBet8CyowHcN' -const { - ROPSTEN, - ROPSTEN_CODE, - ROPSTEN_CHAINID, - RINKEBY_CODE, - RINKEBY_CHAINID, - RINKEBY, - KOVAN, - KOVAN_CODE, - KOVAN_CHAINID, - MAINNET, - MAINNET_CODE, - MAINNET_CHAINID, - ETH_TICK, - POA_SOKOL, - POA_CODE, - POA_CHAINID, - POA_TICK, - POA, - DAI, - DAI_CODE, - DAI_CHAINID, - GOERLI_TESTNET, - GOERLI_TESTNET_CODE, - GOERLI_TESTNET_CHAINID, - POA_SOKOL_CODE, - POA_SOKOL_CHAINID, -} = require('./enums') module.exports = createPocketClient function createPocketClient ({ network }) { - const networkIDs = getNetworkIds({ network }) + const networkID = getNetworkID({ network }) const pocketMiddleware = createPocketMiddleware(devid, { - netID: networkIDs.netId, - network: networkIDs.ticker, + netID: networkID.netId, + network: networkID.ticker, }) const pocketProvider = providerFromMiddleware(pocketMiddleware) const blockTracker = new BlockTracker({ provider: pocketProvider }) @@ -61,64 +34,11 @@ function createPocketClient ({ network }) { return { networkMiddleware, blockTracker } } -function getNetworkIds ({ network }) { - let chainId - let netId - let ticker - switch (network) { - case MAINNET: - netId = MAINNET_CODE.toString() - chainId = MAINNET_CHAINID - ticker = ETH_TICK - break - case ROPSTEN: - netId = ROPSTEN_CODE.toString() - chainId = ROPSTEN_CHAINID - ticker = ETH_TICK - break - case RINKEBY: - netId = RINKEBY_CODE.toString() - chainId = RINKEBY_CHAINID - ticker = ETH_TICK - break - case KOVAN: - netId = KOVAN_CODE.toString() - chainId = KOVAN_CHAINID - ticker = ETH_TICK - break - case GOERLI_TESTNET: - netId = GOERLI_TESTNET_CODE.toString() - chainId = GOERLI_TESTNET_CHAINID - ticker = ETH_TICK - break - case POA: - netId = POA_CODE.toString() - chainId = POA_CHAINID - ticker = POA_TICK - break - case DAI: - netId = DAI_CODE.toString() - chainId = DAI_CHAINID - ticker = POA_TICK - break - case POA_SOKOL: - netId = POA_SOKOL_CODE.toString() - chainId = POA_SOKOL_CHAINID - ticker = POA_TICK - break - default: - throw new Error(`createPocketClient - unknown network "${network}"`) - } - return { - chainId, netId, ticker, - } -} - function createNetworkAndChainIdMiddleware ({ network }) { - const networkIds = getNetworkIds({network}) + const networkID = getNetworkID({network}) return createScaffoldMiddleware({ - eth_chainId: networkIds.chainId, - net_version: networkIds.netId, + eth_chainId: networkID.chainId, + net_version: networkID.netId, }) } diff --git a/app/scripts/controllers/network/enums.js b/app/scripts/controllers/network/enums.js index 1b340afa3b6d..2bd0d9254dec 100644 --- a/app/scripts/controllers/network/enums.js +++ b/app/scripts/controllers/network/enums.js @@ -13,15 +13,20 @@ const LOCALHOST = 'localhost' const ETH_TICK = 'ETH' const POA_TICK = 'POA' +const RSK_TICK = 'RBTC' +const CLASSIC_TICK = 'ETC' -const MAINNET_CHAINID = '0X01' +const MAINNET_CHAINID = '0x01' const ROPSTEN_CHAINID = '0x03' const RINKEBY_CHAINID = '0x04' const KOVAN_CHAINID = '0x2a' -const GOERLI_TESTNET_CHAINID = '0X5' +const GOERLI_TESTNET_CHAINID = '0x5' const POA_CHAINID = '0x63' const DAI_CHAINID = '0x64' const POA_SOKOL_CHAINID = '0x4D' +const RSK_CHAINID = '0x1E' +const RSK_TESTNET_CHAINID = '0x1F' +const CLASSIC_CHAINID = '0x3D' const POA_CODE = 99 const DAI_CODE = 100 @@ -68,6 +73,8 @@ module.exports = { POA, POA_TICK, ETH_TICK, + RSK_TICK, + CLASSIC_TICK, MAINNET_CHAINID, ROPSTEN_CHAINID, RINKEBY_CHAINID, @@ -76,6 +83,8 @@ module.exports = { POA_CHAINID, DAI_CHAINID, POA_SOKOL_CHAINID, + RSK_CHAINID, + RSK_TESTNET_CHAINID, DAI, POA_SOKOL, MAINNET, @@ -96,6 +105,7 @@ module.exports = { KOVAN_CODE, GOERLI_TESTNET_CODE, CLASSIC_CODE, + CLASSIC_CHAINID, RSK_CODE, RSK_TESTNET_CODE, POA_DISPLAY_NAME, diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js index beaee48df4dd..15c22af2f36a 100644 --- a/app/scripts/controllers/network/network.js +++ b/app/scripts/controllers/network/network.js @@ -201,9 +201,10 @@ module.exports = class NetworkController extends EventEmitter { // _switchNetwork (opts) { + const previousNetworkID = this.getNetworkState() this.setNetworkState('loading') this._configureProvider(opts) - this.emit('networkDidChange', opts.type) + this.emit('networkDidChange', opts.type, previousNetworkID) } _configureProvider (opts) { diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index bc89f9f41751..32937ee096dc 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -54,7 +54,7 @@ const ethUtil = require('ethereumjs-util') const sigUtil = require('eth-sig-util') const { importTypes } = require('../../old-ui/app/accounts/import/enums') const { LEDGER, TREZOR } = require('../../old-ui/app/components/connect-hardware/enum') -const { ifPOA, ifRSK } = require('../../old-ui/app/util') +const { ifPOA, ifRSK, getNetworkID } = require('../../old-ui/app/util') const { CLASSIC_CODE, @@ -155,9 +155,24 @@ module.exports = class MetamaskController extends EventEmitter { }) // ensure accountTracker updates balances after network change - this.networkController.on('networkDidChange', () => { + this.networkController.on('networkDidChange', (newType, previousNetworkIDStr) => { this.accountTracker._updateAccounts() this.detectTokensController.restartTokenDetection() + + const previousNetworkID = parseInt(previousNetworkIDStr, 10) + const nextNetwork = getNetworkID({network: newType}) + const nextNetworkID = parseInt(nextNetwork && nextNetwork.netId, 10) + + if (nextNetworkID !== previousNetworkID) { + const isPreviousETC = previousNetworkID === CLASSIC_CODE + const isPreviousRSK = ifRSK(previousNetworkID) + const isNextETC = nextNetworkID === CLASSIC_CODE + const isNextRSK = ifRSK(nextNetworkID) + if (isPreviousETC || isPreviousRSK || isNextETC || isNextRSK) { + this.forgetDevice(LEDGER, false) + this.forgetDevice(TREZOR, false) + } + } }) // key mgmt diff --git a/old-ui/app/components/account-dropdowns/accounts-dropdown-item-view.js b/old-ui/app/components/account-dropdowns/accounts-dropdown-item-view.js index a00786170d3c..2f74eb9e3f01 100644 --- a/old-ui/app/components/account-dropdowns/accounts-dropdown-item-view.js +++ b/old-ui/app/components/account-dropdowns/accounts-dropdown-item-view.js @@ -16,6 +16,7 @@ class AccountsDropdownItemView extends Component { identity: PropTypes.object.isRequired, actions: PropTypes.objectOf(PropTypes.func), closeMenu: PropTypes.func, + network: PropTypes.string, } constructor (props) { @@ -117,7 +118,7 @@ class AccountsDropdownItemView extends Component { this.props.actions.showAccountDetail(address) if (ifHardwareAcc(keyring)) { if (isLedger(keyring.type)) { - const hdPaths = getHdPaths() + const hdPaths = getHdPaths(this.props.network) return new Promise((resolve, reject) => { this.props.actions.connectHardwareAndUnlockAddress(LEDGER, hdPaths[1].value, address) .then(_ => resolve()) diff --git a/old-ui/app/components/connect-hardware/account-list.js b/old-ui/app/components/connect-hardware/account-list.js index 9f88219f1fc2..5f5e44d362e1 100644 --- a/old-ui/app/components/connect-hardware/account-list.js +++ b/old-ui/app/components/connect-hardware/account-list.js @@ -26,9 +26,9 @@ class AccountList extends Component { } renderHdPathSelector = () => { - const { onPathChange, selectedPath } = this.props + const { onPathChange, selectedPath, network } = this.props - const options = getHdPaths() + const options = getHdPaths(network) return (

Select HD Path

diff --git a/old-ui/app/components/connect-hardware/index.js b/old-ui/app/components/connect-hardware/index.js index 77c38e74ac21..8b1b3f8bc575 100644 --- a/old-ui/app/components/connect-hardware/index.js +++ b/old-ui/app/components/connect-hardware/index.js @@ -46,10 +46,11 @@ class ConnectHardwareForm extends Component { async checkIfUnlocked () { [TREZOR, LEDGER].forEach(async device => { - const unlocked = await this.props.checkHardwareStatus(device, this.props.defaultHdPaths[device]) + const hdPath = this._setHdPath(device) + const unlocked = await this.props.checkHardwareStatus(device, hdPath) if (unlocked) { this.setState({unlocked: true}) - this.getPage(device, 0, this.props.defaultHdPaths[device]) + this.getPage(device, 0, hdPath) } }) } @@ -66,8 +67,10 @@ class ConnectHardwareForm extends Component { return null } + const hdPath = this._setHdPath(device) + // Default values - this.getPage(device, 0, this.props.defaultHdPaths[device]) + this.getPage(device, 0, hdPath) } onPathChange = (path) => { @@ -201,7 +204,7 @@ class ConnectHardwareForm extends Component { return ( ) } + + _setHdPath (device) { + let hdPath + const {network, customHdPaths, defaultHdPaths} = this.props + const networkInteger = parseInt(network, 10) + if (customHdPaths.hasOwnProperty(networkInteger)) { + hdPath = customHdPaths[networkInteger][device] + } else { + hdPath = defaultHdPaths[device] + } + return hdPath + } } ConnectHardwareForm.propTypes = { @@ -257,6 +272,7 @@ ConnectHardwareForm.propTypes = { accounts: PropTypes.object, address: PropTypes.string, defaultHdPaths: PropTypes.object, + customHdPaths: PropTypes.object, } const mapStateToProps = state => { @@ -266,7 +282,7 @@ const mapStateToProps = state => { const accounts = getMetaMaskAccounts(state) const numberOfExistingAccounts = Object.keys(identities).length const { - appState: { defaultHdPaths }, + appState: { defaultHdPaths, customHdPaths }, } = state return { @@ -275,6 +291,7 @@ const mapStateToProps = state => { address: selectedAddress, numberOfExistingAccounts, defaultHdPaths, + customHdPaths, } } diff --git a/old-ui/app/components/connect-hardware/util.js b/old-ui/app/components/connect-hardware/util.js index f796c148024d..8ea2f7499b1c 100644 --- a/old-ui/app/components/connect-hardware/util.js +++ b/old-ui/app/components/connect-hardware/util.js @@ -1,4 +1,5 @@ import { LEDGER, TREZOR } from './enum' +import { RSK_CODE, RSK_TESTNET_CODE, CLASSIC_CODE } from '../../../../app/scripts/controllers/network/enums' function isLedger (device) { return device && device.toLowerCase().includes(LEDGER) @@ -8,21 +9,69 @@ function isTrezor (device) { return device && device.toLowerCase().includes(TREZOR) } -function getHdPaths () { - return [ - { - label: `Ledger Live`, - value: `m/44'/60'/0'/0/0`, - }, - { - label: `Legacy (MEW / MyCrypto)`, - value: `m/44'/60'/0'`, - }, - ] +function getHdPaths (network) { + const networkInteger = parseInt(network, 10) + let hdPaths + if (customHdPaths.hasOwnProperty(networkInteger)) { + hdPaths = [ + { + label: `Ledger Live`, + value: customHdPaths[networkInteger]['ledgerLive'], + }, + { + label: `Legacy (MEW / MyCrypto)`, + value: customHdPaths[networkInteger]['ledger'], + }, + ] + } else { + hdPaths = [ + { + label: `Ledger Live`, + value: `m/44'/60'/0'/0/0`, + }, + { + label: `Legacy (MEW / MyCrypto)`, + value: `m/44'/60'/0'`, + }, + ] + } + return hdPaths +} + +const hdRSKMainnetTrezorPath = `m/44'/137'/0'/0` +const hdRSKMainnetLedgerPath = `m/44'/137'/0'/0` +const hdRSKMainnetLedgerLivePath = `m/44'/137'/0'/0` + +const hdRSKTestnetTrezorPath = `m/44'/37310'/0'/0` +const hdRSKTestnetLedgerPath = `m/44'/37310'/0'/0` +const hdRSKTestnetLedgerLivePath = `m/44'/37310'/0'/0` + +const hdETCTrezorPath = `m/44'/61'/0'/0` +const hdETCLedgerPath = `m/44'/60'/160720'/0'` +const hdETCLedgerLivePath = `m/44'/60'/160720'/0'` + +const customHdPaths = {} +customHdPaths[RSK_CODE] = { + trezor: hdRSKMainnetTrezorPath, + ledger: hdRSKMainnetLedgerPath, + ledgeLive: hdRSKMainnetLedgerLivePath, +} + +customHdPaths[RSK_TESTNET_CODE] = { + trezor: hdRSKTestnetTrezorPath, + ledger: hdRSKTestnetLedgerPath, + ledgeLive: hdRSKTestnetLedgerLivePath, +} + +customHdPaths[CLASSIC_CODE] = { + trezor: hdETCTrezorPath, + ledger: hdETCLedgerPath, + ledgeLive: hdETCLedgerLivePath, } module.exports = { isLedger, isTrezor, - getHdPaths, + getHdPaths, + customHdPaths, } diff --git a/old-ui/app/util.js b/old-ui/app/util.js index cecbe2f5ef5e..c892aef8a71e 100644 --- a/old-ui/app/util.js +++ b/old-ui/app/util.js @@ -1,23 +1,44 @@ const ethUtil = require('ethereumjs-util') const ethNetProps = require('eth-net-props') const { - POA_SOKOL_CODE, - POA_CODE, - DAI_CODE, - RSK_CODE, - RSK_TESTNET_CODE, ROPSTEN, + ROPSTEN_CODE, + ROPSTEN_CHAINID, + RINKEBY_CODE, + RINKEBY_CHAINID, RINKEBY, KOVAN, + KOVAN_CODE, + KOVAN_CHAINID, MAINNET, - LOCALHOST, + MAINNET_CODE, + MAINNET_CHAINID, + ETH_TICK, POA_SOKOL, + POA_CODE, + POA_CHAINID, + POA_TICK, POA, DAI, + DAI_CODE, + DAI_CHAINID, GOERLI_TESTNET, + GOERLI_TESTNET_CODE, + GOERLI_TESTNET_CHAINID, + POA_SOKOL_CODE, + POA_SOKOL_CHAINID, + RSK_CODE, + RSK_CHAINID, + RSK_TESTNET_CODE, + RSK_TESTNET_CHAINID, + LOCALHOST, CLASSIC, + CLASSIC_CODE, + CLASSIC_CHAINID, + CLASSIC_TICK, RSK, RSK_TESTNET, + RSK_TICK, } = require('../../app/scripts/controllers/network/enums') var valueTable = { @@ -72,6 +93,7 @@ module.exports = { isValidChecksumAddress, isInfuraProvider, isKnownProvider, + getNetworkID, } function valuesFor (obj) { @@ -462,3 +484,71 @@ function isKnownProvider (type) { type === RSK || type === RSK_TESTNET } + +function getNetworkID ({ network }) { + let chainId + let netId + let ticker + switch (network) { + case MAINNET: + netId = MAINNET_CODE.toString() + chainId = MAINNET_CHAINID + ticker = ETH_TICK + break + case ROPSTEN: + netId = ROPSTEN_CODE.toString() + chainId = ROPSTEN_CHAINID + ticker = ETH_TICK + break + case RINKEBY: + netId = RINKEBY_CODE.toString() + chainId = RINKEBY_CHAINID + ticker = ETH_TICK + break + case KOVAN: + netId = KOVAN_CODE.toString() + chainId = KOVAN_CHAINID + ticker = ETH_TICK + break + case GOERLI_TESTNET: + netId = GOERLI_TESTNET_CODE.toString() + chainId = GOERLI_TESTNET_CHAINID + ticker = ETH_TICK + break + case POA: + netId = POA_CODE.toString() + chainId = POA_CHAINID + ticker = POA_TICK + break + case DAI: + netId = DAI_CODE.toString() + chainId = DAI_CHAINID + ticker = POA_TICK + break + case POA_SOKOL: + netId = POA_SOKOL_CODE.toString() + chainId = POA_SOKOL_CHAINID + ticker = POA_TICK + break + case RSK: + netId = RSK_CODE.toString() + chainId = RSK_CHAINID + ticker = RSK_TICK + break + case RSK_TESTNET: + netId = RSK_TESTNET_CODE.toString() + chainId = RSK_TESTNET_CHAINID + ticker = RSK_TICK + break + case CLASSIC: + netId = CLASSIC_CODE.toString() + chainId = CLASSIC_CHAINID + ticker = CLASSIC_TICK + break + default: + console.error(`getNetworkID - unknown network "${network}"`) + } + return { + chainId, netId, ticker, + } +} diff --git a/package-lock.json b/package-lock.json index bac57b8ef853..ad537f9311b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14732,36 +14732,10 @@ "requires": { "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "ethereumjs-util": "^5.1.1" - }, - "dependencies": { - "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#8431eab7b3384e65e8126a4602520b78031666fb", - "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", - "requires": { - "bn.js": "^4.11.8", - "ethereumjs-util": "^6.0.0" - }, - "dependencies": { - "ethereumjs-util": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", - "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", - "requires": { - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "ethjs-util": "0.1.6", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", - "secp256k1": "^3.0.1" - } - } - } - } } }, "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#d84a96796079c8595a0c78accd1e7709f2277215", + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1cfbb13862f90f0b391d8a699544d5fe4dfb8c7b", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "requires": { "bn.js": "^4.11.8", @@ -14769,16 +14743,16 @@ }, "dependencies": { "ethereumjs-util": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", - "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.0.tgz", + "integrity": "sha512-vb0XN9J2QGdZGIEKG2vXM+kUdEivUfU6Wmi5y0cg+LRhDYKnXIZ/Lz7XjFbHRR9VIKq2lVGLzGBkA++y2nOdOQ==", "requires": { + "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", "ethjs-util": "0.1.6", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", + "keccak": "^2.0.0", + "rlp": "^2.2.3", "secp256k1": "^3.0.1" } } @@ -14796,6 +14770,19 @@ "rlp": "^2.0.0", "safe-buffer": "^5.1.1", "secp256k1": "^3.0.1" + }, + "dependencies": { + "keccak": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", + "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", + "requires": { + "bindings": "^1.2.1", + "inherits": "^2.0.3", + "nan": "^2.2.1", + "safe-buffer": "^5.1.0" + } + } } }, "events": { @@ -14812,6 +14799,27 @@ "safe-buffer": "^5.1.1", "secp256k1": "^3.0.1" } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "keccak": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-2.1.0.tgz", + "integrity": "sha512-m1wbJRTo+gWbctZWay9i26v5fFnYkOn7D5PCxJ3fZUGUEb49dE1Pm4BREUYCt/aoO6di7jeoGmhvqN9Nzylm3Q==", + "requires": { + "bindings": "^1.5.0", + "inherits": "^2.0.4", + "nan": "^2.14.0", + "safe-buffer": "^5.2.0" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" } } }, @@ -15135,8 +15143,8 @@ } }, "eth-trezor-keyring": { - "version": "github:vbaranov/eth-trezor-keyring#97eae35b7de7e1107f11de74635d787750596e10", - "from": "github:vbaranov/eth-trezor-keyring#0.3.0--clear-accounts-flag", + "version": "github:vbaranov/eth-trezor-keyring#17710ee330ff24b61586c9e4a322cedddd07e554", + "from": "github:vbaranov/eth-trezor-keyring#0.4.0", "requires": { "eth-sig-util": "^1.4.2", "ethereumjs-tx": "^1.3.4", @@ -15153,36 +15161,10 @@ "requires": { "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "ethereumjs-util": "^5.1.1" - }, - "dependencies": { - "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#8431eab7b3384e65e8126a4602520b78031666fb", - "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", - "requires": { - "bn.js": "^4.11.8", - "ethereumjs-util": "^6.0.0" - }, - "dependencies": { - "ethereumjs-util": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", - "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", - "requires": { - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "ethjs-util": "0.1.6", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", - "secp256k1": "^3.0.1" - } - } - } - } } }, "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#d8d7fc9cc1fd781186c25676af100d1ec727013e", + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1cfbb13862f90f0b391d8a699544d5fe4dfb8c7b", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "requires": { "bn.js": "^4.11.8", @@ -15190,16 +15172,16 @@ }, "dependencies": { "ethereumjs-util": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", - "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.0.tgz", + "integrity": "sha512-vb0XN9J2QGdZGIEKG2vXM+kUdEivUfU6Wmi5y0cg+LRhDYKnXIZ/Lz7XjFbHRR9VIKq2lVGLzGBkA++y2nOdOQ==", "requires": { + "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", "ethjs-util": "0.1.6", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", + "keccak": "^2.0.0", + "rlp": "^2.2.3", "secp256k1": "^3.0.1" } } @@ -15217,6 +15199,19 @@ "rlp": "^2.0.0", "safe-buffer": "^5.1.1", "secp256k1": "^3.0.1" + }, + "dependencies": { + "keccak": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", + "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", + "requires": { + "bindings": "^1.2.1", + "inherits": "^2.0.3", + "nan": "^2.2.1", + "safe-buffer": "^5.1.0" + } + } } }, "events": { @@ -15233,6 +15228,27 @@ "safe-buffer": "^5.1.1", "secp256k1": "^3.0.1" } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "keccak": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-2.1.0.tgz", + "integrity": "sha512-m1wbJRTo+gWbctZWay9i26v5fFnYkOn7D5PCxJ3fZUGUEb49dE1Pm4BREUYCt/aoO6di7jeoGmhvqN9Nzylm3Q==", + "requires": { + "bindings": "^1.5.0", + "inherits": "^2.0.4", + "nan": "^2.14.0", + "safe-buffer": "^5.2.0" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" } } }, @@ -50688,9 +50704,9 @@ "dev": true }, "trezor-connect": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/trezor-connect/-/trezor-connect-7.0.3.tgz", - "integrity": "sha512-1Y1ajCDF8dC5d2yrCUmVkNqXeOlucamQ6j6Ko7kaqNdge3g9KZ+O48jUwP/eGzei8oUvPZUHd7o4OhDHTlpLCw==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/trezor-connect/-/trezor-connect-7.0.5.tgz", + "integrity": "sha512-cGHcNuO/kGVF6b1mp5VB/RwXcXwqZJDPLp3opx7vM+BQ8xB4oDAUdL+T8aCKRbDv6HwP/wvGwoaok/+9kYOPfA==", "requires": { "@babel/runtime": "^7.3.1", "events": "^3.0.0", diff --git a/package.json b/package.json index f0c668f0f6be..7ee0cc91a7e1 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "eth-query": "^2.1.2", "eth-sig-util": "^2.2.0", "eth-token-watcher": "^1.1.6", - "eth-trezor-keyring": "github:vbaranov/eth-trezor-keyring#0.3.0--clear-accounts-flag", + "eth-trezor-keyring": "github:vbaranov/eth-trezor-keyring#0.4.0", "ethereumjs-abi": "^0.6.7", "ethereumjs-tx": "^1.3.0", "ethereumjs-util": "github:ethereumjs/ethereumjs-util#ac5d0908536b447083ea422b435da27f26615de9", diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 63034796e902..48df9ad2cebe 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -1,6 +1,7 @@ const extend = require('xtend') const actions = require('../actions') const txHelper = require('../../lib/tx-helper') +const { customHdPaths } = require('../../../old-ui/app/components/connect-hardware/util.js') const log = require('loglevel') module.exports = reduceApp @@ -75,6 +76,7 @@ function reduceApp (state, action) { trezor: `m/44'/60'/0'/0`, ledger: `m/44'/60'/0'/0/0`, }, + customHdPaths: customHdPaths, }, state.appState) let curPendingTxIndex = appState.currentView.pendingTxIndex || 0