From bfd9d513e8803e2e045e6cd0bd4c605d2bbb6c57 Mon Sep 17 00:00:00 2001 From: SeungjunWe Date: Wed, 15 Jul 2020 14:40:33 +0900 Subject: [PATCH 1/7] dcent integration --- app/_locales/en/messages.json | 2 +- app/_locales/ko/messages.json | 2 +- app/images/dcent-logo.svg | 1 + app/scripts/metamask-controller.js | 8 ++- .../connect-hardware/connect-screen.js | 21 ++++++- .../app/components/connect-hardware/enum.js | 2 + .../app/components/connect-hardware/index.js | 4 +- package-lock.json | 60 +++++++++++++++++++ package.json | 1 + ui/app/reducers/app.js | 1 + 10 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 app/images/dcent-logo.svg diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index c69efac362fb..12b9e3ef1853 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -749,7 +749,7 @@ "description": "choice between creating or importing a new account" }, "orderOneHere": { - "message": "Order a Trezor or Ledger and keep your funds in cold storage" + "message": "Order a Trezor, Ledger or D'CENT and keep your funds in cold storage" }, "origin": { "message": "Origin" diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index b6fcce8650b9..cfb275c0c6ba 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -731,7 +731,7 @@ "description": "새 계정을 만들거나 가져오기 중에 선택하기" }, "orderOneHere": { - "message": "Trezor 혹은 Ledger를 구입하고 자금을 콜드 스토리지에 저장합니다" + "message": "Trezor, Ledger 혹은 D'CENT를 구입하고 자금을 콜드 스토리지에 저장합니다" }, "origin": { "message": "Origin" diff --git a/app/images/dcent-logo.svg b/app/images/dcent-logo.svg new file mode 100644 index 000000000000..7bbfe47168ff --- /dev/null +++ b/app/images/dcent-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 225a9266089c..77cc5b9edef3 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -57,10 +57,11 @@ import seedPhraseVerifier from './lib/seed-phrase-verifier' import log from 'loglevel' const TrezorKeyring = require('eth-trezor-keyring') const LedgerBridgeKeyring = require('eth-ledger-bridge-keyring') +import DcentKeyring from 'eth-dcent-keyring' import EthQuery from 'eth-query' import nanoid from 'nanoid' const { importTypes } = require('../../old-ui/app/accounts/import/enums') -const { LEDGER, TREZOR } = require('../../old-ui/app/components/connect-hardware/enum') +const { LEDGER, TREZOR, DCENT } = require('../../old-ui/app/components/connect-hardware/enum') const { ifPOA, ifXDai, ifRSK, getNetworkID, getDPath, setDPath } = require('../../old-ui/app/util') const { GasPriceOracle } = require('gas-price-oracle') @@ -204,7 +205,7 @@ module.exports = class MetamaskController extends EventEmitter { }) // key mgmt - const additionalKeyrings = [TrezorKeyring, LedgerBridgeKeyring] + const additionalKeyrings = [TrezorKeyring, LedgerBridgeKeyring, DcentKeyring] this.keyringController = new KeyringController({ keyringTypes: additionalKeyrings, initState: initState.KeyringController, @@ -729,6 +730,9 @@ module.exports = class MetamaskController extends EventEmitter { case LEDGER: keyringName = LedgerBridgeKeyring.type break + case DCENT: + keyringName = DcentKeyring.type + break default: throw new Error('MetamaskController:getKeyringForDevice - Unknown device') } diff --git a/old-ui/app/components/connect-hardware/connect-screen.js b/old-ui/app/components/connect-hardware/connect-screen.js index 4d38ae3ead68..5a1b1894f52d 100644 --- a/old-ui/app/components/connect-hardware/connect-screen.js +++ b/old-ui/app/components/connect-hardware/connect-screen.js @@ -1,7 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import Button from '../../../../ui/app/components/button' -import { LEDGER, TREZOR } from './enum' +import { LEDGER, TREZOR, DCENT } from './enum' import { capitalizeFirstLetter } from '../../../../app/scripts/lib/util' const trezorCap = capitalizeFirstLetter(TREZOR) @@ -49,6 +49,17 @@ class ConnectScreen extends Component { ) } + renderConnectToDcentButton () { + return ( + + ) + } + renderButtons () { return (
@@ -56,6 +67,9 @@ class ConnectScreen extends Component { {this.renderConnectToLedgerButton()} {this.renderConnectToTrezorButton()}
+
+ {this.renderConnectToDcentButton()} +