Skip to content

Commit

Permalink
Merge pull request #468 from poanetwork/develop
Browse files Browse the repository at this point in the history
5.2.6
  • Loading branch information
vbaranov committed Sep 21, 2021
2 parents 99df293 + c61221a commit 3080b5b
Show file tree
Hide file tree
Showing 14 changed files with 63,469 additions and 18,630 deletions.
62 changes: 42 additions & 20 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,54 +14,74 @@ jobs:
prep-deps-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install npm 6 + deps via npm
node-version: '14.x'
- name: Install npm 7 + deps via npm
run: |
sudo npm install -g npm@6.14.5 && npm install --no-save
sudo npm install -g npm@7.22.0 && npm install --no-save --legacy-peer-deps
test-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install npm 6 + deps via npm
node-version: '14.x'
- name: Install npm 7 + deps via npm
run: |
sudo npm install -g npm@6.14.5 && npm install --no-save
sudo npm install -g npm@7.22.0 && npm install --no-save --legacy-peer-deps
- name: lint
run: npm run lint

test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install npm 6 + deps via npm
node-version: '14.x'
- name: Install npm 7 + deps via npm
run: |
sudo npm install -g npm@6.14.5 && npm install --no-save
sudo npm install -g npm@7.22.0 && npm install --no-save --legacy-peer-deps
- name: test:coverage
run: npm run test:coverage

# test-integration-flat-chrome:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - uses: actions/checkout@v2
# with:
# persist-credentials: false
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: '10.x'
# - name: Install npm 6 + deps via npm
# node-version: '14.x'
# - name: Install npm 7 + deps via npm
# run: |
# sudo npm install -g npm@6.14.5 && npm install --no-save
# sudo npm install -g npm@7.22.0 && npm install --no-save
# - name: Enable Chrome
# run: |
# sudo apt-get update
Expand All @@ -75,14 +95,16 @@ jobs:
# test-e2e-chrome:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
# - uses: actions/checkout@v2
# with:
# persist-credentials: false
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: '10.x'
# - name: Install npm 6 + deps via npm
# node-version: '14.x'
# - name: Install npm 7 + deps via npm
# run: |
# sudo npm install -g npm@6.14.5 && npm install --no-save
# sudo npm install -g npm@7.22.0 && npm install --no-save
# - name: Enable Chrome
# run: |
# sudo apt-get update
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Current Master

## 5.2.6 Tue Sep 21 2021

- [#466](https://github.com/poanetwork/nifty-wallet/pull/466) - Update NPM dependencies to match Node v14.x
- [#403](https://github.com/poanetwork/nifty-wallet/pull/403), [#467](https://github.com/poanetwork/nifty-wallet/pull/467) - Add D'CENT hardware wallet support

## 5.2.5 Fri May 21 2021

- [#459](https://github.com/poanetwork/nifty-wallet/pull/459) - (Fix) Phishing detection
Expand Down
2 changes: 1 addition & 1 deletion app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion app/_locales/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@
"description": "새 계정을 만들거나 가져오기 중에 선택하기"
},
"orderOneHere": {
"message": "Trezor 혹은 Ledger를 구입하고 자금을 콜드 스토리지에 저장합니다"
"message": "Trezor, Ledger 혹은 D'CENT를 구입하고 자금을 콜드 스토리지에 저장합니다"
},
"origin": {
"message": "Origin"
Expand Down
1 change: 1 addition & 0 deletions app/images/dcent-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "5.2.5",
"version": "5.2.6",
"manifest_version": 2,
"author": "POA Network",
"description": "__MSG_appDescription__",
Expand Down
8 changes: 6 additions & 2 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,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')
import {
Expand Down Expand Up @@ -192,7 +193,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,
Expand Down Expand Up @@ -763,6 +764,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')
}
Expand Down
19 changes: 16 additions & 3 deletions old-ui/app/components/connect-hardware/connect-screen.js
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -49,12 +49,24 @@ class ConnectScreen extends Component {
)
}

renderConnectToDcentButton () {
return (
<button
className={`hw-connect__btn${this.state.selectedDevice === DCENT ? ' selected' : ''}`}
onClick={(_) => this.setState({ selectedDevice: DCENT })}
>
<img className="hw-connect__btn__img" src="images/dcent-logo.svg"/>
</button>
)
}

renderButtons () {
return (
<div>
<div className="hw-connect__btn-wrapper">
{this.renderConnectToLedgerButton()}
{this.renderConnectToTrezorButton()}
{this.renderConnectToDcentButton()}
</div>
<button
className={`hw-connect__connect-btn${!this.state.selectedDevice ? ' disabled' : ''}`}
Expand Down Expand Up @@ -94,10 +106,11 @@ class ConnectScreen extends Component {
const links = {
trezor: `<a class='hw-connect__get-hw__link' href='https://shop.trezor.io/?a=niftywallet' target='_blank'>${trezorCap}</a>`,
ledger: `<a class='hw-connect__get-hw__link' href='https://www.ledger.com/products/ledger-nano-s' target='_blank'>${ledgerCap}</a>`,
dcent: `<a class='hw-connect__get-hw__link' href='https://dcentwallet.com/Shop?utm_source=metamask&utm_medium=affiliate&utm_campaign=202005-metamask-promotion' target='_blank'>D'CENT</a>`,
}

const text = `Order a ${trezorCap} or ${ledgerCap} and keep your funds in cold storage`
const response = text.replace(trezorCap, links.trezor).replace(ledgerCap, links.ledger)
const text = `Order a ${trezorCap}, ${ledgerCap} or D'CENT and keep your funds in cold storage`
const response = text.replace(trezorCap, links.trezor).replace(ledgerCap, links.ledger).replace(`D'CENT`, links.dcent)

return (
<div className="hw-connect__get-hw__msg" dangerouslySetInnerHTML={{ __html: response }} />
Expand Down
2 changes: 2 additions & 0 deletions old-ui/app/components/connect-hardware/enum.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const LEDGER = 'ledger'
const TREZOR = 'trezor'
const DCENT = 'dcent'

module.exports = {
LEDGER,
TREZOR,
DCENT,
}
4 changes: 2 additions & 2 deletions old-ui/app/components/connect-hardware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { formatBalance } from '../../util'
import { getPlatform } from '../../../../app/scripts/lib/util'
import { PLATFORM_FIREFOX } from '../../../../app/scripts/lib/enums'
import { getMetaMaskAccounts } from '../../../../ui/app/selectors'
import { LEDGER, TREZOR } from './enum'
import { LEDGER, TREZOR, DCENT } from './enum'

class ConnectHardwareForm extends Component {
constructor (props, context) {
Expand Down Expand Up @@ -45,7 +45,7 @@ class ConnectHardwareForm extends Component {
}

async checkIfUnlocked () {
[TREZOR, LEDGER].forEach(async device => {
[TREZOR, LEDGER, DCENT].forEach(async device => {
const hdPath = this._setHdPath(device)
const unlocked = await this.props.checkHardwareStatus(device, hdPath)
if (unlocked) {
Expand Down
14 changes: 10 additions & 4 deletions old-ui/app/css/hw.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
flex-direction: row;
display: flex;
}
.hw-connect__btn-wrapper:not(:first-of-type) {
margin-top: 15px;
}
.hw-connect__connect-btn {
color: #fff;
border: none;
Expand All @@ -49,23 +52,26 @@
.hw-connect__btn {
background: #fbfbfb;
border: 1px solid #e5e5e5;
height: 100px;
width: 150px;
height: 75px;
width: 50px;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
}
.hw-connect__btn__img {
width: 95px;
width: 65px;
}
.hw-connect__btn.selected {
border: 2px solid #60DB97;
width: 149px;
}
.hw-connect__btn:first-child {
.hw-connect__btn:not(:last-of-type) {
margin-right: 15px;
}
.hw-connect__btn:first-child {

}
.hw-connect__btn:last-child {

Expand Down
Loading

0 comments on commit 3080b5b

Please sign in to comment.